Files
Slnkdwf/SlnkDWFImpl/SLNKContourImpl.h
Jos Groot Lipman 742b659ae0 Fixjes in whipfile.AddContour
svn path=/Slnkdwf/trunk/; revision=18375
2013-07-05 09:12:19 +00:00

73 lines
2.8 KiB
C++

#pragma once
#include "Whiptk/whip_toolkit.h"
#define FONT_SIZER 1000
class CWhipFile; // Forward declaration
class CSLNKContourImpl :
public WT_Polygon
{
public:
typedef enum {
LABEL_DEFAULT,
LABEL_CENTROID, // Not guaranteed inside
LABEL_TOPLEFT,
LABEL_OUTSIDERIGHT,
LABEL_OUTSIDEBOTTOM
} LABELPOS;
CSLNKContourImpl(void);
CSLNKContourImpl(
int count, /**< The number of points in the array. */
WT_Logical_Point const * points, /**< Pointer to the array of points. */
WT_Boolean copy, /**< Whether the points should be copied or if their addresses should be used directly from the array. */
CWhipFile *parent
)
: WT_Polygon(count, points, copy), m_outlineColor(128,128,128,255), m_fromSymbol(false), m_onTop(false)
{
m_Color = WT_RGBA32(0,0,0,0); // alpha==0, 100% transparant
m_Lineweight = 10.0; // 10 mm default
m_Fontheight = 200.0;
m_Labelpos = LABEL_DEFAULT;
m_parentWhipFile = parent;
}
~CSLNKContourImpl(void);
public:
WT_String m_contLabel; // As scanned from DWF-file
CString m_Key; // standaard m_contLabel voor contouren maar kan (en voor symbolen moet) een andere waarde krijgen
WT_Color m_Color; // Vul-kleur
WT_Color m_outlineColor; // Contour kleur
BOOL m_onTop; // Deze wordt later (bovenop) getekend dan degene die niet onTop hebben
BOOL m_fromSymbol; // Dan zijn onze bounds maar matig betrouwbaar zo lang ze niet getransformeerd zijn.
CWhipFile *m_parentWhipFile;
WT_Fill_Pattern m_Pattern;
WT_Logical_Point m_ptLabel; // Coordinates of the label
CString m_ShowLabel; // As will be shown
WT_URL_Item m_Url; // Can be defined
double m_DWGArea; // As determined, original source drawing units
double m_Lineweight; // DWG coordinaten
LABELPOS m_Labelpos; // Label position
double m_Fontheight; // Font hoogte in mm
WT_Result serialize(WT_File & file, BOOL solidOnly, BOOL forFind, double scale);
static BOOL PointInPolygon(const WT_Logical_Point pt, const WT_Point_Set &ps);
static BOOL PointInPolygon(const CPoint pt, const CPoint *ps, int size);
static void EdgeAngle(const WT_Logical_Point pt, const WT_Point_Set &ps, double &EdgeAngle, double &EdgeDistance);
static double DWFArea(const WT_Point_Set &pg);
static WT_Logical_Point Centroid(const WT_Point_Set &pg);
WT_Logical_Point LabelPosition(LABELPOS pos = LABEL_DEFAULT);
void SerializeLabel(WT_File &my_file, double scale, HDC myDC);
WT_Logical_Point DrawOneLabel(WT_File &my_file,
WT_Logical_Point ptTxt,
CString tok,
int l_fontheight,
double scale,
HDC myDC, int width=-2);
void AddPoint(double pValX, double pValY, WT_Units units);
void AddPoint(WT_Logical_Point pt);
static WT_Integer32 m_next_node_num;
};