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