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 #ifndef _SDR_CONTACT_VIEWCONTACTOFE3D_HXX
25 #define _SDR_CONTACT_VIEWCONTACTOFE3D_HXX
26 
27 #include <svx/sdr/contact/viewcontactofsdrobj.hxx>
28 #include <drawinglayer/primitive3d/baseprimitive3d.hxx>
29 
30 //////////////////////////////////////////////////////////////////////////////
31 // predeclarations
32 
33 namespace sdr { namespace contact {
34 	class ViewContactOfE3dScene;
35 }}
36 
37 namespace drawinglayer { namespace attribute {
38 	class SdrLineAttribute;
39 }}
40 
41 namespace basegfx {
42 	class BColor;
43     class B3DHomMatrix;
44 }
45 
46 class E3dObject;
47 
48 //////////////////////////////////////////////////////////////////////////////
49 
50 namespace sdr
51 {
52 	namespace contact
53 	{
54 		class ViewContactOfE3d : public ViewContactOfSdrObj
55 		{
56 		protected:
57 			// Create a Object-Specific ViewObjectContact, set ViewContact and
58 			// ObjectContact. Always needs to return something.
59 			virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
60 
61 		public:
62 			// basic constructor, used from E3dObject.
63 			ViewContactOfE3d(E3dObject& rObj);
64 			virtual ~ViewContactOfE3d();
65 
66 			// access to E3dObject
GetE3dObject() const67 			E3dObject& GetE3dObject() const
68 			{
69 				return (E3dObject&)GetSdrObject();
70 			}
71 
72 			// public helpers
73     		drawinglayer::primitive2d::Primitive2DSequence impCreateWithGivenPrimitive3DSequence(
74                 const drawinglayer::primitive3d::Primitive3DSequence& rxContent3D) const;
75 
76 			//////////////////////////////////////////////////////////////////////////////
77 			// primitive stuff
78 
79 		protected:
80 			// Primitive3DSequence of the ViewContact. This contains all necessary information
81 			// for the graphical visualisation and needs to be supported by all 3D VCs which
82 			// can be visualized. It does NOT contain the object transformation to be able to
83 			// buffer for all possible usages
84 			drawinglayer::primitive3d::Primitive3DSequence              mxViewIndependentPrimitive3DSequence;
85 
86 			// This method is responsible for creating the graphical visualisation data which is
87 			// stored in mxViewIndependentPrimitive3DSequence, but without object transformation
88 			virtual drawinglayer::primitive3d::Primitive3DSequence createViewIndependentPrimitive3DSequence() const = 0;
89 
90 			// This method is responsible for creating the graphical visualisation data derived ONLY from
91             // the model data. The default implementation will try to create a 3D to 2D embedding (will work
92 			// when scene is known) which can then be used for 2D processing concerning ranges
93 			virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
94 
95 			// helper to enable test-visualisation of invisible 3D obects
96 			drawinglayer::attribute::SdrLineAttribute* impCreateFallbackLineAttribute(const basegfx::BColor& rBColor) const;
97 
98 		public:
99 			// access to the local primitive without the object's local 3D transform. This is e.g. needed
100 			// to get the not-yet transformed BoundVolume for e.g. interactions
101 			drawinglayer::primitive3d::Primitive3DSequence getVIP3DSWithoutObjectTransform() const;
102 
103 			// access to the local primitive. This will ensure that the list is
104 			// current in comparing the local list content with a fresh created incarnation. It will
105 			// use getVIP3DSWithoutObjectTransform and embed to 3d transform primitive when object's
106 			// local 3d transform is used
107 			drawinglayer::primitive3d::Primitive3DSequence getViewIndependentPrimitive3DSequence() const;
108 		};
109 	} // end of namespace contact
110 } // end of namespace sdr
111 
112 //////////////////////////////////////////////////////////////////////////////
113 
114 #endif //_SDR_CONTACT_VIEWCONTACTOFE3D_HXX
115 
116 // eof
117