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 INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX 25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX 26 27 #include <drawinglayer/drawinglayerdllapi.h> 28 #include <drawinglayer/primitive2d/baseprimitive2d.hxx> 29 #include <drawinglayer/attribute/fillgraphicattribute.hxx> 30 #include <basegfx/polygon/b2dpolypolygon.hxx> 31 #include <drawinglayer/attribute/lineattribute.hxx> 32 #include <drawinglayer/attribute/strokeattribute.hxx> 33 #include <drawinglayer/attribute/linestartendattribute.hxx> 34 #include <drawinglayer/attribute/fillgradientattribute.hxx> 35 #include <drawinglayer/attribute/fillhatchattribute.hxx> 36 #include <drawinglayer/primitive2d/primitivetools2d.hxx> 37 #include <basegfx/color/bcolor.hxx> 38 39 ////////////////////////////////////////////////////////////////////////////// 40 // PolyPolygonHairlinePrimitive2D class 41 42 namespace drawinglayer 43 { 44 namespace primitive2d 45 { 46 /** PolyPolygonHairlinePrimitive2D class 47 48 This primitive defines a multi-PolygonHairlinePrimitive2D and is 49 just for convenience. The definition is not different from the single 50 defined PolygonHairlinePrimitive2Ds. 51 */ 52 class DRAWINGLAYER_DLLPUBLIC PolyPolygonHairlinePrimitive2D : public BufferedDecompositionPrimitive2D 53 { 54 private: 55 /// the hairline geometry 56 basegfx::B2DPolyPolygon maPolyPolygon; 57 58 /// the hairline color 59 basegfx::BColor maBColor; 60 61 protected: 62 /// local decomposition. 63 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 64 65 public: 66 /// constructor 67 PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor); 68 69 /// data read access getB2DPolyPolygon() const70 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } getBColor() const71 const basegfx::BColor& getBColor() const { return maBColor; } 72 73 /// compare operator 74 virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 75 76 /// get range 77 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; 78 79 /// provide unique ID 80 DeclPrimitrive2DIDBlock() 81 }; 82 } // end of namespace primitive2d 83 } // end of namespace drawinglayer 84 85 ////////////////////////////////////////////////////////////////////////////// 86 // PolyPolygonMarkerPrimitive2D class 87 88 namespace drawinglayer 89 { 90 namespace primitive2d 91 { 92 /** PolyPolygonMarkerPrimitive2D class 93 94 This primitive defines a multi-PolygonMarkerPrimitive2D and is 95 just for convenience. The definition is not different from the single 96 defined PolygonMarkerPrimitive2Ds. 97 */ 98 class DRAWINGLAYER_DLLPUBLIC PolyPolygonMarkerPrimitive2D : public BufferedDecompositionPrimitive2D 99 { 100 private: 101 /// the marker hairline geometry 102 basegfx::B2DPolyPolygon maPolyPolygon; 103 104 /// the two colors 105 basegfx::BColor maRGBColorA; 106 basegfx::BColor maRGBColorB; 107 108 /// the dash distance in 'pixels' 109 double mfDiscreteDashLength; 110 111 protected: 112 /// local decomposition. 113 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 114 115 public: 116 /// constructor 117 PolyPolygonMarkerPrimitive2D( 118 const basegfx::B2DPolyPolygon& rPolyPolygon, 119 const basegfx::BColor& rRGBColorA, 120 const basegfx::BColor& rRGBColorB, 121 double fDiscreteDashLength); 122 123 // data read access getB2DPolyPolygon() const124 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } getRGBColorA() const125 const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } getRGBColorB() const126 const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } getDiscreteDashLength() const127 double getDiscreteDashLength() const { return mfDiscreteDashLength; } 128 129 /// compare operator 130 virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 131 132 /// get range 133 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; 134 135 /// provide unique ID 136 DeclPrimitrive2DIDBlock() 137 }; 138 } // end of namespace primitive2d 139 } // end of namespace drawinglayer 140 141 ////////////////////////////////////////////////////////////////////////////// 142 // PolyPolygonStrokePrimitive2D class 143 144 namespace drawinglayer 145 { 146 namespace primitive2d 147 { 148 /** PolyPolygonStrokePrimitive2D class 149 150 This primitive defines a multi-PolygonStrokePrimitive2D and is 151 just for convenience. The definition is not different from the single 152 defined PolygonStrokePrimitive2Ds. 153 */ 154 class DRAWINGLAYER_DLLPUBLIC PolyPolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D 155 { 156 private: 157 /// the line geometry 158 basegfx::B2DPolyPolygon maPolyPolygon; 159 160 /// the line attributes like width, join and color 161 attribute::LineAttribute maLineAttribute; 162 163 /// the line stroking (if used) 164 attribute::StrokeAttribute maStrokeAttribute; 165 166 protected: 167 /// local decomposition. 168 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 169 170 public: 171 /// constructor 172 PolyPolygonStrokePrimitive2D( 173 const basegfx::B2DPolyPolygon& rPolyPolygon, 174 const attribute::LineAttribute& rLineAttribute, 175 const attribute::StrokeAttribute& rStrokeAttribute); 176 177 /// constructor without stroking 178 PolyPolygonStrokePrimitive2D( 179 const basegfx::B2DPolyPolygon& rPolyPolygon, 180 const attribute::LineAttribute& rLineAttribute); 181 182 /// data read access getB2DPolyPolygon() const183 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } getLineAttribute() const184 const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; } getStrokeAttribute() const185 const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } 186 187 /// compare operator 188 virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 189 190 /// get range 191 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; 192 193 /// provide unique ID 194 DeclPrimitrive2DIDBlock() 195 }; 196 } // end of namespace primitive2d 197 } // end of namespace drawinglayer 198 199 ////////////////////////////////////////////////////////////////////////////// 200 // PolyPolygonStrokeArrowPrimitive2D class 201 202 namespace drawinglayer 203 { 204 namespace primitive2d 205 { 206 /** PolyPolygonStrokePrimitive2D class 207 208 This primitive defines a multi-PolygonStrokeArrowPrimitive2D and is 209 just for convenience. The definition is not different from the single 210 defined PolygonStrokeArrowPrimitive2Ds. 211 */ 212 class DRAWINGLAYER_DLLPUBLIC PolyPolygonStrokeArrowPrimitive2D : public PolyPolygonStrokePrimitive2D 213 { 214 private: 215 /// geometric definitions for line start and end 216 attribute::LineStartEndAttribute maStart; 217 attribute::LineStartEndAttribute maEnd; 218 219 protected: 220 /// local decomposition. 221 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 222 223 public: 224 /// constructor 225 PolyPolygonStrokeArrowPrimitive2D( 226 const basegfx::B2DPolyPolygon& rPolyPolygon, 227 const attribute::LineAttribute& rLineAttribute, 228 const attribute::StrokeAttribute& rStrokeAttribute, 229 const attribute::LineStartEndAttribute& rStart, 230 const attribute::LineStartEndAttribute& rEnd); 231 232 /// constructor without stroking 233 PolyPolygonStrokeArrowPrimitive2D( 234 const basegfx::B2DPolyPolygon& rPolyPolygon, 235 const attribute::LineAttribute& rLineAttribute, 236 const attribute::LineStartEndAttribute& rStart, 237 const attribute::LineStartEndAttribute& rEnd); 238 239 /// data read access getStart() const240 const attribute::LineStartEndAttribute& getStart() const { return maStart; } getEnd() const241 const attribute::LineStartEndAttribute& getEnd() const { return maEnd; } 242 243 /// compare operator 244 virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 245 246 /// get range 247 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; 248 249 /// provide unique ID 250 DeclPrimitrive2DIDBlock() 251 }; 252 } // end of namespace primitive2d 253 } // end of namespace drawinglayer 254 255 ////////////////////////////////////////////////////////////////////////////// 256 // PolyPolygonColorPrimitive2D class 257 258 namespace drawinglayer 259 { 260 namespace primitive2d 261 { 262 /** PolyPolygonColorPrimitive2D class 263 264 This primitive defines a PolyPolygon filled with a single color. 265 This is one of the non-decomposable primitives, so a renderer 266 should process it. 267 */ 268 class DRAWINGLAYER_DLLPUBLIC PolyPolygonColorPrimitive2D : public BasePrimitive2D 269 { 270 private: 271 /// the PolyPolygon geometry 272 basegfx::B2DPolyPolygon maPolyPolygon; 273 274 /// the polygon fill color 275 basegfx::BColor maBColor; 276 277 public: 278 /// constructor 279 PolyPolygonColorPrimitive2D( 280 const basegfx::B2DPolyPolygon& rPolyPolygon, 281 const basegfx::BColor& rBColor); 282 283 /// data read access getB2DPolyPolygon() const284 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } getBColor() const285 const basegfx::BColor& getBColor() const { return maBColor; } 286 287 /// compare operator 288 virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 289 290 /// get range 291 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; 292 293 /// provide unique ID 294 DeclPrimitrive2DIDBlock() 295 }; 296 } // end of namespace primitive2d 297 } // end of namespace drawinglayer 298 299 ////////////////////////////////////////////////////////////////////////////// 300 // PolyPolygonGradientPrimitive2D class 301 302 namespace drawinglayer 303 { 304 namespace primitive2d 305 { 306 /** PolyPolygonColorPrimitive2D class 307 308 This primitive defines a PolyPolygon filled with a gradient. The 309 decomosition will create a MaskPrimitive2D containing a 310 FillGradientPrimitive2D. 311 */ 312 class DRAWINGLAYER_DLLPUBLIC PolyPolygonGradientPrimitive2D : public BufferedDecompositionPrimitive2D 313 { 314 private: 315 /// the PolyPolygon geometry 316 basegfx::B2DPolyPolygon maPolyPolygon; 317 318 /// the definition range 319 basegfx::B2DRange maDefinitionRange; 320 321 /// the gradient definition 322 attribute::FillGradientAttribute maFillGradient; 323 324 protected: 325 /// local decomposition. 326 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 327 328 public: 329 /// constructors. The one without definition range will use output range as definition range 330 PolyPolygonGradientPrimitive2D( 331 const basegfx::B2DPolyPolygon& rPolyPolygon, 332 const attribute::FillGradientAttribute& rFillGradient); 333 PolyPolygonGradientPrimitive2D( 334 const basegfx::B2DPolyPolygon& rPolyPolygon, 335 const basegfx::B2DRange& rDefinitionRange, 336 const attribute::FillGradientAttribute& rFillGradient); 337 338 /// data read access getB2DPolyPolygon() const339 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } getDefinitionRange() const340 const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; } getFillGradient() const341 const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; } 342 343 /// compare operator 344 virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 345 346 /// provide unique ID 347 DeclPrimitrive2DIDBlock() 348 }; 349 } // end of namespace primitive2d 350 } // end of namespace drawinglayer 351 352 ////////////////////////////////////////////////////////////////////////////// 353 // PolyPolygonHatchPrimitive2D class 354 355 namespace drawinglayer 356 { 357 namespace primitive2d 358 { 359 /** PolyPolygonHatchPrimitive2D class 360 361 This primitive defines a PolyPolygon filled with a hatch. The 362 decomosition will create a MaskPrimitive2D containing a 363 FillHatchPrimitive2D. 364 */ 365 class DRAWINGLAYER_DLLPUBLIC PolyPolygonHatchPrimitive2D : public BufferedDecompositionPrimitive2D 366 { 367 private: 368 /// the PolyPolygon geometry 369 basegfx::B2DPolyPolygon maPolyPolygon; 370 371 /// the definition range 372 basegfx::B2DRange maDefinitionRange; 373 374 /// the hatch background color (if used) 375 basegfx::BColor maBackgroundColor; 376 377 /// the hatch definition 378 attribute::FillHatchAttribute maFillHatch; 379 380 protected: 381 /// local decomposition. 382 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 383 384 public: 385 /// constructors. The one without definition range will use output range as definition range 386 PolyPolygonHatchPrimitive2D( 387 const basegfx::B2DPolyPolygon& rPolyPolygon, 388 const basegfx::BColor& rBackgroundColor, 389 const attribute::FillHatchAttribute& rFillHatch); 390 PolyPolygonHatchPrimitive2D( 391 const basegfx::B2DPolyPolygon& rPolyPolygon, 392 const basegfx::B2DRange& rDefinitionRange, 393 const basegfx::BColor& rBackgroundColor, 394 const attribute::FillHatchAttribute& rFillHatch); 395 396 /// data read access getB2DPolyPolygon() const397 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } getDefinitionRange() const398 const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; } getBackgroundColor() const399 const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; } getFillHatch() const400 const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; } 401 402 /// compare operator 403 virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 404 405 /// provide unique ID 406 DeclPrimitrive2DIDBlock() 407 }; 408 } // end of namespace primitive2d 409 } // end of namespace drawinglayer 410 411 ////////////////////////////////////////////////////////////////////////////// 412 // PolyPolygonGraphicPrimitive2D class 413 414 namespace drawinglayer 415 { 416 namespace primitive2d 417 { 418 /** PolyPolygonGraphicPrimitive2D class 419 420 This primitive defines a PolyPolygon filled with bitmap data 421 (including transparence). The decomosition will create a MaskPrimitive2D 422 containing a FillGraphicPrimitive2D. 423 */ 424 class DRAWINGLAYER_DLLPUBLIC PolyPolygonGraphicPrimitive2D : public BufferedDecompositionPrimitive2D 425 { 426 private: 427 /// the PolyPolygon geometry 428 basegfx::B2DPolyPolygon maPolyPolygon; 429 430 /// the definition range 431 basegfx::B2DRange maDefinitionRange; 432 433 /// the bitmap fill definition (may include tiling) 434 attribute::FillGraphicAttribute maFillGraphic; 435 436 protected: 437 /// local decomposition. 438 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 439 440 public: 441 /// constructors. The one without definition range will use output range as definition range 442 PolyPolygonGraphicPrimitive2D( 443 const basegfx::B2DPolyPolygon& rPolyPolygon, 444 const attribute::FillGraphicAttribute& rFillGraphic); 445 PolyPolygonGraphicPrimitive2D( 446 const basegfx::B2DPolyPolygon& rPolyPolygon, 447 const basegfx::B2DRange& rDefinitionRange, 448 const attribute::FillGraphicAttribute& rFillGraphic); 449 450 /// data read access getB2DPolyPolygon() const451 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } getDefinitionRange() const452 const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; } getFillGraphic() const453 const attribute::FillGraphicAttribute& getFillGraphic() const { return maFillGraphic; } 454 455 /// compare operator 456 virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 457 458 /// provide unique ID 459 DeclPrimitrive2DIDBlock() 460 }; 461 } // end of namespace primitive2d 462 } // end of namespace drawinglayer 463 464 ////////////////////////////////////////////////////////////////////////////// 465 // PolyPolygonSelectionPrimitive2D class 466 467 namespace drawinglayer 468 { 469 namespace primitive2d 470 { 471 /** PolyPolygonSelectionPrimitive2D class 472 473 This primitive defines a PolyPolygon which gets filled with a defined color 474 and a defined transparence, but also gets extended ('grown') by the given 475 discrete size (thus being a view-dependent primitive) 476 */ 477 class DRAWINGLAYER_DLLPUBLIC PolyPolygonSelectionPrimitive2D : public DiscreteMetricDependentPrimitive2D 478 { 479 private: 480 /// the PolyPolygon geometry 481 basegfx::B2DPolyPolygon maPolyPolygon; 482 483 /// the color 484 basegfx::BColor maColor; 485 486 /// the transparence [0.0 .. 1.0] 487 double mfTransparence; 488 489 /// the discrete grow size ('pixels'), only posivive values allowed 490 double mfDiscreteGrow; 491 492 /// bitfield 493 /// draw polygons filled when fill is set 494 bool mbFill : 1; 495 496 protected: 497 /// local decomposition. 498 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 499 500 public: 501 /// constructor 502 PolyPolygonSelectionPrimitive2D( 503 const basegfx::B2DPolyPolygon& rPolyPolygon, 504 const basegfx::BColor& rColor, 505 double fTransparence, 506 double fDiscreteGrow, 507 bool bFill); 508 509 /// data read access getB2DPolyPolygon() const510 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } getColor() const511 const basegfx::BColor& getColor() const { return maColor; } getTransparence() const512 double getTransparence() const { return mfTransparence; } getDiscreteGrow() const513 double getDiscreteGrow() const { return mfDiscreteGrow; } getFill() const514 bool getFill() const { return mbFill; } 515 516 /// compare operator 517 virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 518 519 /// get range 520 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; 521 522 /// provide unique ID 523 DeclPrimitrive2DIDBlock() 524 }; 525 } // end of namespace primitive2d 526 } // end of namespace drawinglayer 527 528 ////////////////////////////////////////////////////////////////////////////// 529 530 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX 531 532 ////////////////////////////////////////////////////////////////////////////// 533 // eof 534