1*464702f4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*464702f4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*464702f4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*464702f4SAndrew Rist  * distributed with this work for additional information
6*464702f4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*464702f4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*464702f4SAndrew Rist  * "License"); you may not use this file except in compliance
9*464702f4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*464702f4SAndrew Rist  *
11*464702f4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*464702f4SAndrew Rist  *
13*464702f4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*464702f4SAndrew Rist  * software distributed under the License is distributed on an
15*464702f4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*464702f4SAndrew Rist  * KIND, either express or implied.  See the License for the
17*464702f4SAndrew Rist  * specific language governing permissions and limitations
18*464702f4SAndrew Rist  * under the License.
19*464702f4SAndrew Rist  *
20*464702f4SAndrew Rist  *************************************************************/
21*464702f4SAndrew Rist 
22*464702f4SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_drawinglayer.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <drawinglayer/processor3d/baseprocessor3d.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
30cdf0e10cSrcweir 
31cdf0e10cSrcweir using namespace com::sun::star;
32cdf0e10cSrcweir 
33cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace drawinglayer
36cdf0e10cSrcweir {
37cdf0e10cSrcweir 	namespace processor3d
38cdf0e10cSrcweir 	{
processBasePrimitive3D(const primitive3d::BasePrimitive3D &)39cdf0e10cSrcweir 		void BaseProcessor3D::processBasePrimitive3D(const primitive3d::BasePrimitive3D& /*rCandidate*/)
40cdf0e10cSrcweir 		{
41cdf0e10cSrcweir 		}
42cdf0e10cSrcweir 
BaseProcessor3D(const geometry::ViewInformation3D & rViewInformation)43cdf0e10cSrcweir 		BaseProcessor3D::BaseProcessor3D(const geometry::ViewInformation3D& rViewInformation)
44cdf0e10cSrcweir 		:	maViewInformation3D(rViewInformation)
45cdf0e10cSrcweir 		{
46cdf0e10cSrcweir 		}
47cdf0e10cSrcweir 
~BaseProcessor3D()48cdf0e10cSrcweir 		BaseProcessor3D::~BaseProcessor3D()
49cdf0e10cSrcweir 		{
50cdf0e10cSrcweir 		}
51cdf0e10cSrcweir 
process(const primitive3d::Primitive3DSequence & rSource)52cdf0e10cSrcweir 		void BaseProcessor3D::process(const primitive3d::Primitive3DSequence& rSource)
53cdf0e10cSrcweir 		{
54cdf0e10cSrcweir 			if(rSource.hasElements())
55cdf0e10cSrcweir 			{
56cdf0e10cSrcweir 				const sal_Int32 nCount(rSource.getLength());
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 				for(sal_Int32 a(0L); a < nCount; a++)
59cdf0e10cSrcweir 				{
60cdf0e10cSrcweir 					// get reference
61cdf0e10cSrcweir 					const primitive3d::Primitive3DReference xReference(rSource[a]);
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 					if(xReference.is())
64cdf0e10cSrcweir 					{
65cdf0e10cSrcweir 						// try to cast to BasePrimitive3D implementation
66cdf0e10cSrcweir 						const primitive3d::BasePrimitive3D* pBasePrimitive = dynamic_cast< const primitive3d::BasePrimitive3D* >(xReference.get());
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 						if(pBasePrimitive)
69cdf0e10cSrcweir 						{
70cdf0e10cSrcweir 							processBasePrimitive3D(*pBasePrimitive);
71cdf0e10cSrcweir 						}
72cdf0e10cSrcweir 						else
73cdf0e10cSrcweir 						{
74cdf0e10cSrcweir 							// unknown implementation, use UNO API call instead and process recursively
75cdf0e10cSrcweir 							const uno::Sequence< beans::PropertyValue >& rViewParameters(getViewInformation3D().getViewInformationSequence());
76cdf0e10cSrcweir 							process(xReference->getDecomposition(rViewParameters));
77cdf0e10cSrcweir 						}
78cdf0e10cSrcweir 					}
79cdf0e10cSrcweir 				}
80cdf0e10cSrcweir 			}
81cdf0e10cSrcweir 		}
82cdf0e10cSrcweir 	} // end of namespace processor3d
83cdf0e10cSrcweir } // end of namespace drawinglayer
84cdf0e10cSrcweir 
85cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
86cdf0e10cSrcweir 
87cdf0e10cSrcweir namespace drawinglayer
88cdf0e10cSrcweir {
89cdf0e10cSrcweir 	namespace processor3d
90cdf0e10cSrcweir 	{
CollectingProcessor3D(const geometry::ViewInformation3D & rViewInformation)91cdf0e10cSrcweir 		CollectingProcessor3D::CollectingProcessor3D(const geometry::ViewInformation3D& rViewInformation)
92cdf0e10cSrcweir 		:	BaseProcessor3D(rViewInformation),
93cdf0e10cSrcweir 			maPrimitive3DSequence()
94cdf0e10cSrcweir 		{
95cdf0e10cSrcweir 		}
96cdf0e10cSrcweir 
~CollectingProcessor3D()97cdf0e10cSrcweir 		CollectingProcessor3D::~CollectingProcessor3D()
98cdf0e10cSrcweir 		{
99cdf0e10cSrcweir 		}
100cdf0e10cSrcweir 
process(const primitive3d::Primitive3DSequence & rSource)101cdf0e10cSrcweir 		void CollectingProcessor3D::process(const primitive3d::Primitive3DSequence& rSource)
102cdf0e10cSrcweir 		{
103cdf0e10cSrcweir 			// accept everything
104cdf0e10cSrcweir 			primitive3d::appendPrimitive3DSequenceToPrimitive3DSequence(maPrimitive3DSequence, rSource);
105cdf0e10cSrcweir 		}
106cdf0e10cSrcweir 	} // end of namespace processor3d
107cdf0e10cSrcweir } // end of namespace drawinglayer
108cdf0e10cSrcweir 
109cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
110cdf0e10cSrcweir // eof
111