Fixjes in whipfile.AddContour

svn path=/Slnkdwf/trunk/; revision=18375
This commit is contained in:
Jos Groot Lipman
2013-07-05 09:12:19 +00:00
parent 1422da91d0
commit 742b659ae0
4 changed files with 36 additions and 11 deletions

View File

@@ -325,7 +325,7 @@ 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,
void CSLNKContourImpl::SerializeLabel(WT_File &my_file,
double scale,
HDC myDC)
{
@@ -682,6 +682,12 @@ WT_Result CSLNKContourImpl::serialize(WT_File & file, BOOL solidOnly, BOOL forFi
file.desired_rendition().line_weight() = myRound(m_Lineweight * scale);
// Fraaier bij lijndikte aan begin/eind
file.desired_rendition().line_style().line_end_cap() = WT_Line_Style::Round_Cap;
// Als eerste punt ongelijk aan laatste punt dan points() eentje uitbreiden
// De polygon sluit vanzelf wel maar deze polyline niet
if (count() > 2 && (points()[0].m_x != points()[count()-1].m_x || points()[0].m_y != points()[count()-1].m_y))
AddPoint(points()[0]);
WT_Polyline my_line( count(), points(), WD_False);
my_line.serialize(file);
}
@@ -691,8 +697,15 @@ WT_Result CSLNKContourImpl::serialize(WT_File & file, BOOL solidOnly, BOOL forFi
void CSLNKContourImpl::AddPoint(double pValX, double pValY, WT_Units units)
{
bool wasEmpty = (points()[0].m_x == INT_MAX &&
AddPoint(units.transform(WT_Point3D(pValX, pValY)));
}
void CSLNKContourImpl::AddPoint(WT_Logical_Point pt)
{
bool wasEmpty = (points()[0].m_x == INT_MAX &&
points()[0].m_y == INT_MAX);
// TODO: Overflow controle?
WT_Logical_Point *pts = new WT_Logical_Point[count()+1];
int i;
for (i = 0; i < count(); i++)
@@ -700,8 +713,8 @@ void CSLNKContourImpl::AddPoint(double pValX, double pValY, WT_Units units)
pts[i] = points()[i];
}
// Het nieuwe punt
pts[i] = units.transform(WT_Point3D(pValX, pValY));
pts[i] = pt;
// Bij wasEmpty het eerste dummy punt overslaan
set(wasEmpty?1:(count() + 1), &pts[wasEmpty?1:0], true);
@@ -710,5 +723,4 @@ void CSLNKContourImpl::AddPoint(double pValX, double pValY, WT_Units units)
m_ptLabel = points()[0];
delete[] pts;
}

View File

@@ -67,5 +67,6 @@ public:
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;
};