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_svx.hxx" 26 27 #include <svx/sdr/contact/viewobjectcontactofe3d.hxx> 28 #include <svx/sdr/contact/viewcontactofe3d.hxx> 29 #include <basegfx/color/bcolor.hxx> 30 #include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx> 31 #include <svx/sdr/contact/viewobjectcontactofe3dscene.hxx> 32 #include <drawinglayer/primitive2d/embedded3dprimitive2d.hxx> 33 #include <svx/sdr/contact/viewcontactofe3dscene.hxx> 34 35 ////////////////////////////////////////////////////////////////////////////// 36 // predeclarations 37 38 ////////////////////////////////////////////////////////////////////////////// 39 40 namespace sdr 41 { 42 namespace contact 43 { ViewObjectContactOfE3d(ObjectContact & rObjectContact,ViewContact & rViewContact)44 ViewObjectContactOfE3d::ViewObjectContactOfE3d(ObjectContact& rObjectContact, ViewContact& rViewContact) 45 : ViewObjectContactOfSdrObj(rObjectContact, rViewContact) 46 { 47 } 48 ~ViewObjectContactOfE3d()49 ViewObjectContactOfE3d::~ViewObjectContactOfE3d() 50 { 51 } 52 createPrimitive3DSequence(const DisplayInfo & rDisplayInfo) const53 drawinglayer::primitive3d::Primitive3DSequence ViewObjectContactOfE3d::createPrimitive3DSequence(const DisplayInfo& rDisplayInfo) const 54 { 55 // get the view-independent Primitive from the viewContact 56 const ViewContactOfE3d& rViewContactOfE3d(dynamic_cast< const ViewContactOfE3d& >(GetViewContact())); 57 drawinglayer::primitive3d::Primitive3DSequence xRetval(rViewContactOfE3d.getViewIndependentPrimitive3DSequence()); 58 59 // handle ghosted 60 if(isPrimitiveGhosted(rDisplayInfo)) 61 { 62 const ::basegfx::BColor aRGBWhite(1.0, 1.0, 1.0); 63 const ::basegfx::BColorModifierSharedPtr aBColorModifier( 64 new basegfx::BColorModifier_interpolate( 65 aRGBWhite, 66 0.5)); 67 const drawinglayer::primitive3d::Primitive3DReference xReference( 68 new drawinglayer::primitive3d::ModifiedColorPrimitive3D( 69 xRetval, 70 aBColorModifier)); 71 72 xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); 73 } 74 75 return xRetval; 76 } 77 createPrimitive2DSequence(const DisplayInfo & rDisplayInfo) const78 drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfE3d::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const 79 { 80 const ViewContactOfE3d& rViewContact = static_cast< const ViewContactOfE3d& >(GetViewContact()); 81 82 // get 3d primitive vector, isPrimitiveVisible() is done in 3d creator 83 return rViewContact.impCreateWithGivenPrimitive3DSequence(getPrimitive3DSequence(rDisplayInfo)); 84 } 85 getPrimitive3DSequence(const DisplayInfo & rDisplayInfo) const86 drawinglayer::primitive3d::Primitive3DSequence ViewObjectContactOfE3d::getPrimitive3DSequence(const DisplayInfo& rDisplayInfo) const 87 { 88 drawinglayer::primitive3d::Primitive3DSequence xNewPrimitive3DSeq(createPrimitive3DSequence(rDisplayInfo)); 89 90 // local up-to-date checks. New list different from local one? 91 if(!drawinglayer::primitive3d::arePrimitive3DSequencesEqual(mxPrimitive3DSequence, xNewPrimitive3DSeq)) 92 { 93 // has changed, copy content 94 const_cast< ViewObjectContactOfE3d* >(this)->mxPrimitive3DSequence = xNewPrimitive3DSeq; 95 } 96 97 // return current Primitive2DSequence 98 return mxPrimitive3DSequence; 99 } 100 } // end of namespace contact 101 } // end of namespace sdr 102 103 ////////////////////////////////////////////////////////////////////////////// 104 // eof 105