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 #include <svx/sdr/overlay/overlaypolypolygon.hxx>
27 #include <vcl/salbtype.hxx>
28 #include <vcl/outdev.hxx>
29 #include <basegfx/matrix/b2dhommatrix.hxx>
30 #include <basegfx/polygon/b2dpolypolygontools.hxx>
31 #include <svx/sdr/overlay/overlaymanager.hxx>
32 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
33 
34 //////////////////////////////////////////////////////////////////////////////
35 
36 namespace sdr
37 {
38 	namespace overlay
39 	{
40 		drawinglayer::primitive2d::Primitive2DSequence OverlayPolyPolygonStriped::createOverlayObjectPrimitive2DSequence()
41 		{
42 			drawinglayer::primitive2d::Primitive2DSequence aRetval;
43 
44             if(getOverlayManager())
45             {
46                 const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
47                 const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
48                 const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
49 
50                 const drawinglayer::primitive2d::Primitive2DReference aReference(
51                     new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(
52                         getPolyPolygon(),
53                         aRGBColorA,
54                         aRGBColorB,
55                         fStripeLengthPixel));
56 
57                 aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
58             }
59 
60             return aRetval;
61 		}
62 
63 		void OverlayPolyPolygonStriped::stripeDefinitionHasChanged()
64 		{
65 			// react on OverlayManager's stripe definition change
66 			objectChange();
67 		}
68 
69 		OverlayPolyPolygonStriped::OverlayPolyPolygonStriped(
70 			const basegfx::B2DPolyPolygon& rPolyPolygon)
71 		:	OverlayObject(Color(COL_BLACK)),
72 			maPolyPolygon(rPolyPolygon)
73 		{
74 		}
75 
76 		OverlayPolyPolygonStriped::~OverlayPolyPolygonStriped()
77 		{
78 		}
79 
80 		void OverlayPolyPolygonStriped::setPolyPolygon(const basegfx::B2DPolyPolygon& rNew)
81 		{
82 			if(rNew != maPolyPolygon)
83 			{
84 				// remember new value
85 				maPolyPolygon = rNew;
86 
87 				// register change (after change)
88 				objectChange();
89 			}
90 		}
91 	} // end of namespace overlay
92 } // end of namespace sdr
93 
94 //////////////////////////////////////////////////////////////////////////////
95 // eof
96