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_VIEWCONTACTOFE3DSCENE_HXX
25 #define _SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX
26 
27 #include <svx/sdr/contact/viewcontactofsdrobj.hxx>
28 #include <drawinglayer/primitive3d/baseprimitive3d.hxx>
29 #include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
30 #include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
31 #include <drawinglayer/geometry/viewinformation3d.hxx>
32 #include <basegfx/matrix/b2dhommatrix.hxx>
33 
34 //////////////////////////////////////////////////////////////////////////////
35 // predeclarations
36 
37 class E3dScene;
38 
39 namespace basegfx {
40 	class B3DRange;
41 }
42 
43 //////////////////////////////////////////////////////////////////////////////
44 
45 namespace sdr
46 {
47 	namespace contact
48 	{
49 		class SVX_DLLPUBLIC ViewContactOfE3dScene : public ViewContactOfSdrObj
50 		{
51 		protected:
52 			// Create a Object-Specific ViewObjectContact, set ViewContact and
53 			// ObjectContact. Always needs to return something. Default is to create
54 			// a standard ViewObjectContact containing the given ObjectContact and *this
55 			virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
56 
57 		public:
58 			// basic constructor, used from SdrObject.
59 			ViewContactOfE3dScene(E3dScene& rScene);
60 
61 			// access to SdrObject
GetE3dScene() const62 			E3dScene& GetE3dScene() const
63 			{
64 				return (E3dScene&)GetSdrObject();
65 			}
66 
67 			// React on changes of the object of this ViewContact
68 			virtual void ActionChanged();
69 
70 			// access to ViewInformation3D and ObjectTransformation
71 			const drawinglayer::geometry::ViewInformation3D& getViewInformation3D(const ::basegfx::B3DRange& rContentRange) const;
72 			const drawinglayer::geometry::ViewInformation3D& getViewInformation3D() const;
73 			const basegfx::B2DHomMatrix& getObjectTransformation() const;
74 
75 			// attribute providers
76 			const drawinglayer::attribute::SdrSceneAttribute& getSdrSceneAttribute() const;
77 			const drawinglayer::attribute::SdrLightingAttribute& getSdrLightingAttribute() const;
78 
79 			// scene primitive creators. If pLayerVisibility is given, a visibility test with the LayerID and the
80 			// given SetOfByte is done.
81 			drawinglayer::primitive2d::Primitive2DSequence createScenePrimitive2DSequence(const SetOfByte* pLayerVisibility) const;
82 
83             // helpers to get the sequence of all contained 3D primitives and it's range,
84             // regardless of layer or visibility constraints and using a neutral ViewInformation3D
85             drawinglayer::primitive3d::Primitive3DSequence getAllPrimitive3DSequence() const;
86             basegfx::B3DRange getAllContentRange3D() const;
87 
88         protected:
89 			// the 3d transformation stack
90 			drawinglayer::geometry::ViewInformation3D			maViewInformation3D;
91 
92 			// the object transformation
93 			basegfx::B2DHomMatrix								maObjectTransformation;
94 
95 			// attributes
96 			drawinglayer::attribute::SdrSceneAttribute			maSdrSceneAttribute;
97 			drawinglayer::attribute::SdrLightingAttribute		maSdrLightingAttribute;
98 
99 			// create methods for ViewInformation3D and ObjectTransformation
100 			void createViewInformation3D(const ::basegfx::B3DRange& rContentRange);
101 			void createObjectTransformation();
102 
103 			// attribute creators
104 			void createSdrSceneAttribute();
105 			void createSdrLightingAttribute();
106 
107 			// This method is responsible for creating the graphical visualisation data
108             // ONLY based on model data
109 			virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
110 		};
111 	} // end of namespace contact
112 } // end of namespace sdr
113 
114 //////////////////////////////////////////////////////////////////////////////
115 
116 #endif //_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX
117 
118 // eof
119