Fade2.5D Documentation pages v2.16.7
Delaunay Features
CutAndFill.h
Go to the documentation of this file.
1 // Copyright (C) Geom Software e.U, Bernhard Kornberger, Graz/Austria
2 //
3 // This file is part of the Fade2D library. The student license is free
4 // of charge and covers personal non-commercial research. Licensees
5 // holding a commercial license may use this file in accordance with
6 // the Commercial License Agreement.
7 //
8 // This software is provided AS IS with NO WARRANTY OF ANY KIND,
9 // INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
10 // FOR A PARTICULAR PURPOSE.
11 //
12 // Please contact the author if any conditions of this licensing are
13 // not clear to you.
14 //
15 // Author: Bernhard Kornberger, bkorn (at) geom.at
16 // http://www.geom.at
18 
19 #pragma once
20 #include "common.h"
21 #include "MsgBase.h"
22 #include "VtkWriter.h"
23 #include "CAF_Component.h"
24 
25 #if GEOM_PSEUDO3D==GEOM_TRUE
26  namespace GEOM_FADE25D {
27 
28 class Zone2; // FWD;
29 class CutAndFillImpl; // FWD
30 class Visualizer2; // FWD
31 class Fade_2D; // FWD
47 class CLASS_DECLSPEC CutAndFill
48 {
49 public:
60  CutAndFill(Zone2* pZoneBefore,Zone2* pZoneAfter,double ignoreThreshold=1e-6);
61 
64 
84  bool getDiffZone( Zone2*& pDiffZone,
85  std::map<Point2*,std::pair<double,double> >& mVtx2BeforeAfter);
86 
98  void subscribe(MsgType msgType,MsgBase* pMsg);
99 
110  void unsubscribe(MsgType msgType,MsgBase* pMsg);
111 
120  size_t getNumberOfComponents() const;
121 
135  CAF_Component* getComponent(size_t idx) const;
136 
148  bool go(bool bWithMessages=true);
149 
163  void show(Visualizer2* pVis) const;
177  void showVtk(VtkWriter* pVtkWriter,VtkColor cutColor,VtkColor fillColor,VtkColor nullColor) const;
178 protected:
180  CutAndFillImpl* pCAFI;
181 private:
182  CutAndFill(const CutAndFill& ):pCAFI(NULL)
183  {
184  // Never reached
185  }
186  CutAndFill& operator=(const CutAndFill& )
187  {
188  pCAFI=NULL;
189  return *this;
190  }
191 };
192 
193 } // Namespace Fade25D only
194 
195 #elif GEOM_PSEUDO3D==GEOM_FALSE
196 #else
197  #error GEOM_PSEUDO3D is not defined
198 #endif
199 
200 
MsgType
Message types for the message system.
Definition: MsgBase.h:40
VtkColor
Enumeration of colors used by the VTKWriter class to represent various colors in the VTK file format.
Definition: VtkWriter.h:39
CAF_Component represents a connected area of the surface.
Definition: CAF_Component.h:63
Computes the volume differences between two overlapping surfaces.
Definition: CutAndFill.h:48
void subscribe(MsgType msgType, MsgBase *pMsg)
Registers a message receiver object to receive progress updates.
bool getDiffZone(Zone2 *&pDiffZone, std::map< Point2 *, std::pair< double, double > > &mVtx2BeforeAfter)
Retrieves the difference zone between the two surfaces.
bool go(bool bWithMessages=true)
Starts the computation of the cut and fill volumes.
void showVtk(VtkWriter *pVtkWriter, VtkColor cutColor, VtkColor fillColor, VtkColor nullColor) const
Visualizes the result as a .VTK file.
void show(Visualizer2 *pVis) const
Draws a postscript or PDF visualization of the result.
void unsubscribe(MsgType msgType, MsgBase *pMsg)
Unregisters a message receiver object.
size_t getNumberOfComponents() const
Get the number of components.
CAF_Component * getComponent(size_t idx) const
Retrieves the component at the specified index.
CutAndFill(Zone2 *pZoneBefore, Zone2 *pZoneAfter, double ignoreThreshold=1e-6)
Constructor.
MsgBase, a base class for message subscriber classes.
Definition: MsgBase.h:55
Represents a 2.5D point.
Definition: Point2.h:61
A PDF and Postscript Writer for 2D Visualization.
Definition: Visualizer2.h:60
A class for writing data to the VTK file format for visualization purposes.
Definition: VtkWriter.h:76
Represents a defined area within a triangulation.
Definition: Zone2.h:82