v2.91: label positie en font hoogte per contour aan te sturen

svn path=/Slnkdwf/trunk/; revision=18235
This commit is contained in:
Jos Groot Lipman
2013-06-23 12:04:49 +00:00
parent f3c5e430f5
commit 7fa0b6c10d
10 changed files with 153 additions and 58 deletions

View File

@@ -166,3 +166,39 @@ STDMETHODIMP CSLNKContour::put_Lineweight(DOUBLE newVal)
return S_OK;
}
STDMETHODIMP CSLNKContour::get_Fontheight(DOUBLE* pVal)
{
(*pVal) = m_SLNKContour->m_Fontheight;
return S_OK;
}
STDMETHODIMP CSLNKContour::put_Fontheight(DOUBLE newVal)
{
m_SLNKContour->m_Fontheight = newVal;
return S_OK;
}
STDMETHODIMP CSLNKContour::get_Labelposition(BYTE* pVal)
{
(*pVal) = m_SLNKContour->m_Labelpos;
return S_OK;
}
STDMETHODIMP CSLNKContour::put_Labelposition(BYTE newVal)
{
switch (newVal)
{
case 1: m_SLNKContour->m_Labelpos = CSLNKContourImpl::LABEL_DEFAULT; break;
case 2: m_SLNKContour->m_Labelpos = CSLNKContourImpl::LABEL_CENTROID; break;
case 3: m_SLNKContour->m_Labelpos = CSLNKContourImpl::LABEL_TOPLEFT; break;
case 4: m_SLNKContour->m_Labelpos = CSLNKContourImpl::LABEL_OUTSIDERIGHT; break;
case 5: m_SLNKContour->m_Labelpos = CSLNKContourImpl::LABEL_OUTSIDEBOTTOM; break;
default: m_SLNKContour->m_Labelpos = CSLNKContourImpl::LABEL_DEFAULT;
}
return S_OK;
}

View File

@@ -103,6 +103,10 @@ public:
STDMETHOD(put_Hatch)(BYTE newVal);
STDMETHOD(get_Lineweight)(DOUBLE* pVal);
STDMETHOD(put_Lineweight)(DOUBLE newVal);
STDMETHOD(get_Fontheight)(DOUBLE* pVal);
STDMETHOD(put_Fontheight)(DOUBLE newVal);
STDMETHOD(get_Labelposition)(BYTE* pVal);
STDMETHOD(put_Labelposition)(BYTE newVal);
};
//REMOVED OBJECT_ENTRY_AUTO(__uuidof(SLNKContour), CSLNKContour)

View File

@@ -64,6 +64,7 @@ interface IWhipFile : IDispatch{
[propget, id(23), helpstring("property ContourItem")] HRESULT ContourItem([in] ULONG i, [out, retval] ISLNKContour** pVal);
[propget, id(24), helpstring("property minContSize")] HRESULT minContSize([out, retval] DOUBLE* pVal);
[propput, id(24), helpstring("property minContSize")] HRESULT minContSize([in] DOUBLE newVal);
[propget, id(25), helpstring("property AddContour")] HRESULT AddContour([in, defaultvalue (L"")] BSTR Label,[in, defaultvalue (L"")] BSTR Key, [out, retval] ISLNKContour** pVal);
};
[
object,
@@ -246,6 +247,10 @@ interface ISLNKContour : IDispatch{
[propput, id(10), helpstring("property Hatch")] HRESULT Hatch([in] BYTE newVal);
[propget, id(11), helpstring("property Lineweight")] HRESULT Lineweight([out, retval] DOUBLE* pVal);
[propput, id(11), helpstring("property Lineweight")] HRESULT Lineweight([in] DOUBLE newVal);
[propget, id(12), helpstring("property LabelPosition")] HRESULT Labelposition([out, retval] BYTE* pVal);
[propput, id(12), helpstring("property LabelPosition")] HRESULT Labelposition([in] BYTE pVal);
[propget, id(13), helpstring("property Fontheight")] HRESULT Fontheight([out, retval] DOUBLE* pVal);
[propput, id(13), helpstring("property Fontheight")] HRESULT Fontheight([in] DOUBLE pVal);
};
[
object,

View File

@@ -1,6 +1,6 @@
// Zorg dat versies alfabetisch altijd op elkaar volgen!
#define SLNK_MAJOR_VERSION 2
#define SLNK_MINOR_VERSION 90
#define SLNK_MINOR_VERSION 91
#define SLNK_BUILD_VERSION 0
// Define resource strings

View File

@@ -25,6 +25,7 @@ CSLNKSymbolImpl::CSLNKSymbolImpl(double dwgX, double dwgY, CWhipFile *whipfile)
m_SLNKContour.m_parentWhipFile = whipfile;
m_SLNKContour.m_fromSymbol=true;
m_SLNKContour.m_outlineColor.set(0,0,0,0); // alpha=0-->transparant
m_SLNKContour.m_Labelpos = CSLNKContourImpl::LABEL_OUTSIDEBOTTOM; // default voor symbolen
}
WT_Result CSLNKSymbolImpl::serialize (WT_File & file, WT_Units & units,
@@ -50,6 +51,7 @@ WT_Result CSLNKSymbolImpl::serialize (WT_File & file, WT_Units & units,
{
LPInsertion *= wasTransform;
}
m_SLNKContour.m_ptLabel = LPInsertion;
// WT_Transform ondersteunt wel rotaties 0,90,180 en 270. Dat gaat echter altijd om DWF 0,0 (oops: die om MAX_INT/2)
// terwijl wij toch echt om ons insertionpoint willen.
// Het (b)lijkt oplosbaar door ons punt te tegenroteren

View File

@@ -184,7 +184,7 @@ bool CWhip2PNG::CreateCxImage(CxImage *img)
m_offsetX /= m_AAFactor;
m_offsetY /= m_AAFactor;
// Let op dat hij al geroteerd kan zijn en dan is m_sizeX != img->GetWidth()
img->Resample(img->GetWidth()/2, img->GetHeight()/2, m_AAMethod);
img->Resample(img->GetWidth()/m_AAFactor, img->GetHeight()/m_AAFactor, m_AAMethod);
}
return res;
@@ -354,7 +354,7 @@ STDMETHODIMP CWhip2PNG::Find(LONG findX, LONG findY, BSTR* foundLabel)
STDMETHODIMP CWhip2PNG::SetAntialias(LONG lFactor, LONG lMethod)
{
if (lFactor < 1 ||
lFactor > 16 ||
lFactor > 4 || // Boven de 4 loop je al risico op out-of-memory
lMethod < 0 ||
lMethod > 2)
return myAtlReportError (GetObjectCLSID(), "\nCWhip2PNG::SetAntialias invalid parameters");

View File

@@ -35,7 +35,8 @@
// CWhipFile
WT_Logical_Point star[] = { WT_Logical_Point(-1000, 0),
const WT_Logical_Point CWhipFile::star[] =
{ WT_Logical_Point(-1000, 0),
WT_Logical_Point( -200, 200),
WT_Logical_Point( 0, 1000),
WT_Logical_Point( 200, 200),
@@ -46,7 +47,8 @@ WT_Logical_Point star[] = { WT_Logical_Point(-1000, 0),
WT_Logical_Point(-1000, 0)
};
WT_Logical_Point octa[] = { WT_Logical_Point( 1000, 414),
const WT_Logical_Point CWhipFile::octa[] =
{ WT_Logical_Point( 1000, 414),
WT_Logical_Point( 414, 1000),
WT_Logical_Point( -414, 1000),
WT_Logical_Point(-1000, 414),
@@ -57,6 +59,14 @@ WT_Logical_Point octa[] = { WT_Logical_Point( 1000, 414),
WT_Logical_Point( 1000, 414)
};
const WT_Logical_Point CWhipFile::square[] =
{ WT_Logical_Point( 0, 0),
WT_Logical_Point( 0, 1000),
WT_Logical_Point( 1000, 1000),
WT_Logical_Point( 1000, 0),
WT_Logical_Point( 0, 0)
};
CWhipFile::CWhipFile()
{
m_FontName.set("Arial");
@@ -77,6 +87,9 @@ CWhipFile::CWhipFile()
symb = new CSLNKSymbolDefinition(sizeof(octa)/sizeof(octa[0]), octa);
m_SLNKSymbolDefinitions.SetAt("*OCTAGON", symb);
symb = new CSLNKSymbolDefinition(sizeof(square)/sizeof(square[0]), square);
m_SLNKSymbolDefinitions.SetAt("*SQUARE", symb);
}
int xxxx;
@@ -783,16 +796,11 @@ bool CWhipFile::GenerateSymbolLabels(myWT_File &my_file)
for (size_t i=0; i<m_SLNKSymbols.GetCount(); i++)
{
CSLNKSymbolImpl *symbol= m_SLNKSymbols[i];
// Pas op dat de WT_Polygon nog niet getransformeerd is!
// Dat maakt LABEL_CENTROID berekeningen tricky....
// Tegenwoordig: CSLNKSymbolImpl::serialize heeft de contour al getransformeerd
WT_Logical_Point center = m_contunits.transform(WT_Point3D(symbol->m_dwgX, symbol->m_dwgY));
symbol->m_SLNKContour.m_ptLabel = center;
WT_Transform wasTransform = my_file.heuristics().transform();
WT_Boolean wasApplyTransform = my_file.heuristics().apply_transform();
my_file.heuristics().set_apply_transform(WD_False); // Hebben we al rechtstreeks op de contour gedaan
symbol->m_SLNKContour.SerializeLabel(my_file, CSLNKContourImpl::LABEL_OUTSIDEBOTTOM, fontheight, scale, myDC);
symbol->m_SLNKContour.SerializeLabel(my_file, scale, myDC);
// En transform weer terug
my_file.heuristics().set_transform(wasTransform);
my_file.heuristics().set_apply_transform(wasApplyTransform);
@@ -896,7 +904,7 @@ bool CWhipFile::GenerateLabels(WT_File &my_planfile, myWT_File &my_file, double
if (contour->m_contLabel.length()!=0 && contour->m_ShowLabel != "")
{ // We have got a proper label/contour
// Alle teksten tekenen
contour->SerializeLabel(my_file, m_LabelPos, fontheight, scale, myDC);
contour->SerializeLabel(my_file, scale, myDC);
}
}
@@ -1027,17 +1035,31 @@ STDMETHODIMP CWhipFile::SetLabelFont(BSTR FontName, DOUBLE FontHeight, DOUBLE Fo
m_FontHeight = FontHeight;
m_FontHeightSymbols = (FontHeightSymbols>0)?FontHeightSymbols:FontHeight;
for (size_t i=0; i<m_SLNKContouren.GetCount(); i++)
{
CSLNKContourImpl *contour= m_SLNKContouren[i];
contour->m_Fontheight = m_FontHeight;
}
return S_OK;
}
STDMETHODIMP CWhipFile::SetLabelPosition(BYTE LabelPos)
STDMETHODIMP CWhipFile::SetLabelPosition(BYTE p_LabelPos)
{
switch (LabelPos)
CSLNKContourImpl::LABELPOS LabelPos;
switch (p_LabelPos)
{
case 1: m_LabelPos = CSLNKContourImpl::LABEL_DEFAULT; break;
case 2: m_LabelPos = CSLNKContourImpl::LABEL_CENTROID; break;
case 3: m_LabelPos = CSLNKContourImpl::LABEL_TOPLEFT; break;
default: m_LabelPos = CSLNKContourImpl::LABEL_DEFAULT;
case 1: LabelPos = CSLNKContourImpl::LABEL_DEFAULT; break;
case 2: LabelPos = CSLNKContourImpl::LABEL_CENTROID; break;
case 3: LabelPos = CSLNKContourImpl::LABEL_TOPLEFT; break;
case 4: LabelPos = CSLNKContourImpl::LABEL_OUTSIDERIGHT; break;
case 5: LabelPos = CSLNKContourImpl::LABEL_OUTSIDEBOTTOM; break;
default: LabelPos = CSLNKContourImpl::LABEL_DEFAULT;
}
for (size_t i=0; i<m_SLNKContouren.GetCount(); i++)
{
CSLNKContourImpl *contour= m_SLNKContouren[i];
contour->m_Labelpos = LabelPos;
}
return S_OK;
@@ -1050,6 +1072,7 @@ STDMETHODIMP CWhipFile::get_AddSymbol(DOUBLE dwgX, DOUBLE dwgY, BSTR symbolName,
myTRACE("\nAdding symbol %s at %.2f,%.2f", name, dwgX, dwgY);
CSLNKSymbolImpl *mySymbol = new CSLNKSymbolImpl(dwgX, dwgY, this);
mySymbol->m_SLNKContour.m_Fontheight = m_FontHeightSymbols;
m_SLNKSymbols.Add(mySymbol);
// Als resultaat leveren we een COM object op waar je eventueel de rest van
@@ -1233,3 +1256,18 @@ STDMETHODIMP CWhipFile::put_minContSize(DOUBLE newVal)
return S_OK;
}
STDMETHODIMP CWhipFile::get_AddContour(BSTR Label, BSTR Key, ISLNKContour** pVal)
{
return E_NOTIMPL; // Nog niet klaar
// TODO:
// dwgX en dwgY coordinaten toevoegen (vertalen naar DWF coordinaten?)
// Na elk punt voor de zekerheid boundingcontour/ centroid opnieuw?
WT_Logical_Point *pts;
CSLNKContourImpl *myContour = new CSLNKContourImpl(0, pts, WD_True, this);
this->m_SLNKContouren.Add(myContour);
return get_ContourItem((ULONG)m_SLNKContouren.GetCount() - 1, pVal);
};

View File

@@ -62,12 +62,12 @@ public:
STDMETHOD(get_Contour)(BSTR IdentLabel, ISLNKContour** pVal);
STDMETHOD(SetFilterLayers)(BSTR reLayers);
STDMETHOD(get_FindInContour)(DOUBLE dwgX, DOUBLE dwgY, BSTR* pVal);
STDMETHOD(get_AddContour)(BSTR Label, BSTR Key, ISLNKContour** pVal);
private:
WT_String m_FontName;
double m_FontHeight, m_FontHeightSymbols;
CSLNKContourImpl::LABELPOS m_LabelPos;
CComQIPtr<IEPlotSection> m_iEPlotSection; // Om scope levend te houden
myWT_File m_W2DFile;
@@ -155,6 +155,10 @@ private:
CAtlRegExp<> m_reContouren;
CAtlRegExp<> m_reLabels;
CAtlRegExp<> m_reLayers; // Die met SaveAs moeten blijven
const static WT_Logical_Point star[];
const static WT_Logical_Point octa[];
const static WT_Logical_Point square[];
};
OBJECT_ENTRY_AUTO(__uuidof(WhipFile), CWhipFile)

View File

@@ -15,6 +15,8 @@ CSLNKContourImpl::CSLNKContourImpl(void)
{
m_Color = WT_RGBA32(0,0,0,0); // alpha==0, onzichtbaar
m_Lineweight = 10.0; // 10mm default
m_Fontheight = 200.0;
m_Labelpos = LABEL_DEFAULT;
}
CSLNKContourImpl::~CSLNKContourImpl(void)
@@ -195,7 +197,7 @@ Subject 1.02: How do I find the distance from a point to a line?
return;
}
// Vind de hoek van de edge van ps die het dichts bij pt ligt
// Vind de hoek van de edge van ps die het dichtst bij pt ligt
// (het maakt ons niet uit of pt er binnen of buiten ligt)
// A = P2Y - P1Y
// B = P1X - P2X
@@ -323,8 +325,8 @@ WT_Logical_Point CSLNKContourImpl::LabelPosition(LABELPOS pos /*= LABEL_DEFAULT*
return WT_Logical_Point((WT_Integer32)(ptx / dDWFArea6), (WT_Integer32)(pty / dDWFArea6));
}
void CSLNKContourImpl::SerializeLabel(WT_File &my_file, LABELPOS pos,
int fontheight, double scale,
void CSLNKContourImpl::SerializeLabel(WT_File &my_file,
double scale,
HDC myDC)
{
if (m_Color.rgba().m_rgb.a==255)
@@ -340,43 +342,45 @@ void CSLNKContourImpl::SerializeLabel(WT_File &my_file, LABELPOS pos,
my_file.desired_rendition().color() = WT_Color(1,1,1,0);
}
else
my_file.desired_rendition().color() = WT_Color(255,255,255,0); //Teksten wit
my_file.desired_rendition().color() = WT_Color(255,255,255,0); //Teksten wit
CString tok(m_ShowLabel); // strtok seems to modify
tok.Replace("~", "\n"); // We ondersteunen ook ~ als newline
tok.Replace("[br]", "\n"); // We ondersteunen ook [br] als newline
tok.Replace("[BR]", "\n"); // We ondersteunen ook [BR] als newline
WT_Logical_Point ptTxt = LabelPosition(pos);
WT_Logical_Point ptTxt = LabelPosition(m_Labelpos);
int l_fontheight = myRound(m_Fontheight * scale);
// De wiskundige label-positie is bepaald. Nu iets corrigeren om
// (afhankelijk van het font) mooier te zijn
// Ook eventueel hori/vert centreren
int width = -1; // Voor UBB code [c] van centreren
switch (pos)
switch (m_Labelpos)
{
case CSLNKContourImpl::LABEL_DEFAULT:
break;
case CSLNKContourImpl::LABEL_TOPLEFT: // Iets naar rechtstonder moven
ptTxt.m_x += fontheight/4;
ptTxt.m_y -= fontheight;
ptTxt.m_x += l_fontheight/4;
ptTxt.m_y -= l_fontheight;
break;
case CSLNKContourImpl::LABEL_OUTSIDERIGHT: // Iets naar rechts en verticaal centreren
{
// Eerst een keer simuleren om grootte te bepalen
ATLASSERT(myDC!=NULL);
WT_Logical_Point ptBR = DrawOneLabel(my_file, ptTxt, tok, fontheight, scale, myDC);
WT_Logical_Point ptBR = DrawOneLabel(my_file, ptTxt, tok, l_fontheight, scale, myDC);
width = (ptBR.m_x - ptTxt.m_x);
ptTxt.m_y -= (ptBR.m_y - ptTxt.m_y)/2 + fontheight*9/10;
ptTxt.m_x += fontheight/4;
ptTxt.m_y -= (ptBR.m_y - ptTxt.m_y)/2 + l_fontheight*9/10;
ptTxt.m_x += l_fontheight/4;
break;
}
case CSLNKContourImpl::LABEL_OUTSIDEBOTTOM: // Iets naar beneden en horizontaal centreren
{
// Eerst een keer simuleren om grootte te bepalen
ATLASSERT(myDC!=NULL);
WT_Logical_Point ptBR = DrawOneLabel(my_file, ptTxt, tok, fontheight, scale, myDC);
WT_Logical_Point ptBR = DrawOneLabel(my_file, ptTxt, tok, l_fontheight, scale, myDC);
width = (ptBR.m_x - ptTxt.m_x);
ptTxt.m_y -= fontheight;
ptTxt.m_y -= l_fontheight;
ptTxt.m_x -= (ptBR.m_x - ptTxt.m_x)/2;
break;
}
@@ -386,15 +390,15 @@ void CSLNKContourImpl::SerializeLabel(WT_File &my_file, LABELPOS pos,
if (!CSLNKContourImpl::PointInPolygon(ptTxt, *this))
ptTxt = LabelPosition(CSLNKContourImpl::LABEL_DEFAULT);
// Eerst een keer simuleren om grootte te bepalen
WT_Logical_Point ptBR = DrawOneLabel(my_file, ptTxt, tok, fontheight, scale, myDC);
WT_Logical_Point ptBR = DrawOneLabel(my_file, ptTxt, tok, l_fontheight, scale, myDC);
width = (ptBR.m_x - ptTxt.m_x);
ptTxt.m_x -= (ptBR.m_x - ptTxt.m_x)/2;
ptTxt.m_y -= (ptBR.m_y - ptTxt.m_y)/2 + fontheight*9/10;
ptTxt.m_y -= (ptBR.m_y - ptTxt.m_y)/2 + l_fontheight*9/10;
// Nooit verder naar links/boven dan TOPLEFT zou doen
// JGL: jul 2007: Waarom niet? Bij heel kleine ruimtes mag bij centreren de boel er best wel iets buiten
// WT_Logical_Point ptTL = LabelPosition(CSLNKContourImpl::LABEL_TOPLEFT);
//ptTxt.m_x = max(ptTxt.m_x, ptTL.m_x+fontheight/4);
//ptTxt.m_y = min(ptTxt.m_y, ptTL.m_y-fontheight);
//ptTxt.m_x = max(ptTxt.m_x, ptTL.m_x + l_fontheight/4);
//ptTxt.m_y = min(ptTxt.m_y, ptTL.m_y - l_fontheight);
#ifdef _DEBUG
WT_Polymarker pm(1, &ptTxt, true);
pm.serialize(my_file);
@@ -403,7 +407,7 @@ pm.serialize(my_file);
}
// Nu echt tekenen met width<>-2
DrawOneLabel(my_file, ptTxt, tok, fontheight, scale, myDC, width);
DrawOneLabel(my_file, ptTxt, tok, l_fontheight, scale, myDC, width);
}
// Draw one (possibly multline) label
@@ -414,13 +418,14 @@ pm.serialize(my_file);
WT_Logical_Point CSLNKContourImpl::DrawOneLabel(WT_File &my_file,
WT_Logical_Point ptTxt,
CString tok,
int fontheight,
int l_fontheight,
double scale,
HDC myDC,
int width/*=-2*/)// Voor centreren. Moet aanroeper al een keer bepaald hebben
{
long max_width=0; // Bepaal hiermee 'rechtsonder' van de tekst als myDC
my_file.desired_rendition().font().height() = l_fontheight;
//TODO: UBB sluitcodes ondersteunen
int curpos = 0;
CString token = tok.Tokenize("\n", curpos);
@@ -429,11 +434,11 @@ WT_Logical_Point CSLNKContourImpl::DrawOneLabel(WT_File &my_file,
while( token != "" )
{
// invariant (ook bij binnenkomst): ptTxt.m_y bevat het linksonderpunt van de huidige regel
// uitgaande van fontheight. Bij [s] gebruik moeten we dus corrigeren
// uitgaande van l_fontheight. Bij [s] gebruik moeten we dus corrigeren
//CString f(token);
int skipextra = 0; // Extra skip bij underline
long size=100;
int thisLineHeight=fontheight; // mooie default
int thisLineHeight = l_fontheight; // mooie default
// Supported UBB-like codes:
// [[This is literal text in square brackets]
@@ -466,7 +471,7 @@ WT_Logical_Point CSLNKContourImpl::DrawOneLabel(WT_File &my_file,
if (width != -2)
my_file.desired_rendition().font().style().set_underlined(true);
token.Delete(0);
skipextra = fontheight / 5;
skipextra = l_fontheight / 5;
break;
case 'c': // Color or Center
{
@@ -502,9 +507,9 @@ WT_Logical_Point CSLNKContourImpl::DrawOneLabel(WT_File &my_file,
if (bigS)
thisLineHeight = myRound(size * scale);
else
thisLineHeight = myRound(double(size)*fontheight/100);
thisLineHeight = myRound(double(size)*l_fontheight/100);
ptTxt.m_y -= (thisLineHeight - fontheight); // Correctie op de invariant voor huidige regel
ptTxt.m_y -= (thisLineHeight - l_fontheight); // Correctie op de invariant voor huidige regel
if (width != -2)
my_file.desired_rendition().font().height() = thisLineHeight;
}
@@ -543,7 +548,7 @@ WT_Logical_Point CSLNKContourImpl::DrawOneLabel(WT_File &my_file,
my_file.desired_rendition().font().style().set_bold(false);
my_file.desired_rendition().font().style().set_underlined(false);
my_file.desired_rendition().color() = WT_Color(255,255,255,0); //Teksten wit TODO: (contrasteren met background)
my_file.desired_rendition().font().height() = fontheight;
my_file.desired_rendition().font().height() = l_fontheight;
}
else
{
@@ -556,16 +561,16 @@ WT_Logical_Point CSLNKContourImpl::DrawOneLabel(WT_File &my_file,
// Tekst horizontaal en verticaal centreren
// ptRes.m_y += rc.bottom; halen we wel uit ptY
max_width = max(max_width, MulDiv(rc.right,thisLineHeight,fontheight));
max_width = max(max_width, MulDiv(rc.right,thisLineHeight,l_fontheight));
}
line ++;
/* Get next token: */
token = tok.Tokenize("\n", curpos);
ptTxt.m_y -= fontheight + skipextra;
ptTxt.m_y -= l_fontheight + skipextra;
}
return WT_Logical_Point(ptTxt.m_x+MulDiv(max_width,fontheight,FONT_SIZER), ptTxt.m_y);
return WT_Logical_Point(ptTxt.m_x+MulDiv(max_width,l_fontheight,FONT_SIZER), ptTxt.m_y);
}
/****************************************************************************
@@ -686,7 +691,7 @@ WT_Result CSLNKContourImpl::serialize(WT_File & file, BOOL solidOnly, BOOL forFi
#ifndef DWFTK_READ_ONLY
void CSLNKContourImpl::serializeXML( DWFToolkit::DWFXMLSerializer& rSerializer,
void CSLNKContourImpl::serializeXML( DWFToolkit::DWFXMLSerializer& rSerializer,
WT_Units units )
throw( DWFException )
{

View File

@@ -10,7 +10,7 @@ class CSLNKContourImpl :
{
public:
typedef enum {
LABEL_DEFAULT,
LABEL_DEFAULT,
LABEL_CENTROID, // Not guaranteed inside
LABEL_TOPLEFT,
LABEL_OUTSIDERIGHT,
@@ -26,9 +26,11 @@ public:
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;
}
@@ -47,6 +49,8 @@ public:
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);
@@ -55,20 +59,17 @@ public:
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, LABELPOS pos,
int fontheight,
double scale,
HDC myDC);
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 fontheight,
int l_fontheight,
double scale,
HDC myDC, int width=-2);
static WT_Integer32 m_next_node_num;
static WT_Integer32 m_next_node_num;
#ifndef DWFTK_READ_ONLY
void serializeXML( DWFToolkit::DWFXMLSerializer& rSerializer,
void serializeXML( DWFToolkit::DWFXMLSerializer& rSerializer,
WT_Units units )
throw( DWFException );
#endif