14f506f19SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 34f506f19SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 44f506f19SAndrew Rist * or more contributor license agreements. See the NOTICE file 54f506f19SAndrew Rist * distributed with this work for additional information 64f506f19SAndrew Rist * regarding copyright ownership. The ASF licenses this file 74f506f19SAndrew Rist * to you under the Apache License, Version 2.0 (the 84f506f19SAndrew Rist * "License"); you may not use this file except in compliance 94f506f19SAndrew Rist * with the License. You may obtain a copy of the License at 104f506f19SAndrew Rist * 114f506f19SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 124f506f19SAndrew Rist * 134f506f19SAndrew Rist * Unless required by applicable law or agreed to in writing, 144f506f19SAndrew Rist * software distributed under the License is distributed on an 154f506f19SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 164f506f19SAndrew Rist * KIND, either express or implied. See the License for the 174f506f19SAndrew Rist * specific language governing permissions and limitations 184f506f19SAndrew Rist * under the License. 194f506f19SAndrew Rist * 204f506f19SAndrew Rist *************************************************************/ 214f506f19SAndrew Rist 224f506f19SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX 25cdf0e10cSrcweir #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX 26cdf0e10cSrcweir 27090f0eb8SEike Rathke #include <drawinglayer/drawinglayerdllapi.h> 28*0702bc67SArmin Le Grand #include <drawinglayer/primitive2d/primitivetools2d.hxx> 29cdf0e10cSrcweir #include <drawinglayer/attribute/fillhatchattribute.hxx> 30cdf0e10cSrcweir #include <basegfx/color/bcolor.hxx> 31cdf0e10cSrcweir 32cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 33cdf0e10cSrcweir // FillHatchPrimitive2D class 34cdf0e10cSrcweir 35cdf0e10cSrcweir namespace drawinglayer 36cdf0e10cSrcweir { 37cdf0e10cSrcweir namespace primitive2d 38cdf0e10cSrcweir { 39cdf0e10cSrcweir /** FillHatchPrimitive2D class 40cdf0e10cSrcweir 41cdf0e10cSrcweir This class defines a hatch filling for a rectangular area. The 42cdf0e10cSrcweir Range is defined by the Transformation, the hatch by the FillHatchAttribute. 43cdf0e10cSrcweir If the background is to be filled, a flag in FillHatchAttribute is set and 44cdf0e10cSrcweir the BColor defines the background color. 45cdf0e10cSrcweir 46*0702bc67SArmin Le Grand #120230# This primitive is now evtl. metric dependent due to the value 47*0702bc67SArmin Le Grand MinimalDiscreteDistance in the FillHatchAttribute if the value is not zero. 48*0702bc67SArmin Le Grand This is used for a more appealing, VCL-like visualisation by not letting the 49*0702bc67SArmin Le Grand distances get too small between lines. 50*0702bc67SArmin Le Grand 51cdf0e10cSrcweir The decomposition will deliver the hatch lines. 52cdf0e10cSrcweir */ 53*0702bc67SArmin Le Grand class DRAWINGLAYER_DLLPUBLIC FillHatchPrimitive2D : public DiscreteMetricDependentPrimitive2D 54cdf0e10cSrcweir { 55cdf0e10cSrcweir private: 56cdf0e10cSrcweir /// the geometric definition 57cdf0e10cSrcweir basegfx::B2DRange maObjectRange; 58cdf0e10cSrcweir 59cdf0e10cSrcweir /// the hatch definition 60cdf0e10cSrcweir attribute::FillHatchAttribute maFillHatch; 61cdf0e10cSrcweir 62cdf0e10cSrcweir /// hatch background color (if used) 63cdf0e10cSrcweir basegfx::BColor maBColor; 64cdf0e10cSrcweir 65cdf0e10cSrcweir protected: 66cdf0e10cSrcweir /// local decomposition. 67cdf0e10cSrcweir virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 68cdf0e10cSrcweir 69*0702bc67SArmin Le Grand public: 70cdf0e10cSrcweir /// constructor 71cdf0e10cSrcweir FillHatchPrimitive2D( 72cdf0e10cSrcweir const basegfx::B2DRange& rObjectRange, 73cdf0e10cSrcweir const basegfx::BColor& rBColor, 74cdf0e10cSrcweir const attribute::FillHatchAttribute& rFillHatch); 75cdf0e10cSrcweir 76cdf0e10cSrcweir /// data read access getObjectRange() const77cdf0e10cSrcweir const basegfx::B2DRange& getObjectRange() const { return maObjectRange; } getFillHatch() const78cdf0e10cSrcweir const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; } getBColor() const79cdf0e10cSrcweir const basegfx::BColor& getBColor() const { return maBColor; } 80cdf0e10cSrcweir 81cdf0e10cSrcweir /// compare operator 82cdf0e10cSrcweir virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 83cdf0e10cSrcweir 84cdf0e10cSrcweir /// get range 85cdf0e10cSrcweir virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; 86cdf0e10cSrcweir 87*0702bc67SArmin Le Grand /// get local decomposition. Overloaded since this decomposition is view-dependent 88*0702bc67SArmin Le Grand virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 89*0702bc67SArmin Le Grand 90*0702bc67SArmin Le Grand /// provide unique ID 91cdf0e10cSrcweir DeclPrimitrive2DIDBlock() 92cdf0e10cSrcweir }; 93cdf0e10cSrcweir } // end of namespace primitive2d 94cdf0e10cSrcweir } // end of namespace drawinglayer 95cdf0e10cSrcweir 96cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 97cdf0e10cSrcweir 98cdf0e10cSrcweir #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX 99cdf0e10cSrcweir 100cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 101cdf0e10cSrcweir // eof 102