v3.00 want divers deprecated spul verwijderd

whipfile.AddContour en contour.AddPoint toegevoegd

svn path=/Slnkdwf/trunk/; revision=18350
This commit is contained in:
Jos Groot Lipman
2013-07-03 21:55:55 +00:00
parent 7fa0b6c10d
commit 1422da91d0
13 changed files with 64 additions and 82 deletions

View File

@@ -8,7 +8,6 @@ CSLNKOptions g_SLNKOptions; // The one and only
// Set all default values
CSLNKOptions::CSLNKOptions()
{
m_MinContSize = 0.20e6; // Minimale grootte voor een contour om herkend te worden
m_SkipContLeader = FALSE; // ARKEY tekeningen hebben een leading lijntje voor de contour
}
// COptions
@@ -34,13 +33,7 @@ STDMETHODIMP COptions::SetOption(BSTR optionName, VARIANT OptionValue)
CString nm(optionName);
nm.MakeUpper();
if (nm=="MINCONTSIZE") // deprecated sinds 2.80
{
HRESULT hr = val.ChangeType(VT_R8);
if (FAILED(hr)) return hr;
g_SLNKOptions.m_MinContSize = val.dblVal;
}
else if (nm=="SKIPCONTLEADER")
if (nm=="SKIPCONTLEADER")
{
HRESULT hr = val.ChangeType(VT_BOOL);
if (FAILED(hr)) return hr;

View File

@@ -16,7 +16,6 @@ class CSLNKOptions
public:
CSLNKOptions();
double m_MinContSize; // In DWG Units
BOOL m_SkipContLeader; // voor ARKEY
};
extern CSLNKOptions g_SLNKOptions; // The one and only

View File

@@ -202,3 +202,12 @@ STDMETHODIMP CSLNKContour::put_Labelposition(BYTE newVal)
return S_OK;
}
STDMETHODIMP CSLNKContour::AddPoint(DOUBLE pValX, DOUBLE pValY)
{
// Het lijkt nogal onzinnig m_SLNKContour zijn eigen m_contunits door te geven
// SLNKContourImpl.h heeft echter alleen een forward declaration naar CWhipFile
// en compile technisch werd het me anders te ingewikkeld.
m_SLNKContour->AddPoint(pValX, pValY, m_SLNKContour->m_parentWhipFile->m_contunits);
return S_OK;
};

View File

@@ -107,6 +107,7 @@ public:
STDMETHOD(put_Fontheight)(DOUBLE newVal);
STDMETHOD(get_Labelposition)(BYTE* pVal);
STDMETHOD(put_Labelposition)(BYTE newVal);
STDMETHOD(AddPoint)(DOUBLE pValX, DOUBLE pValY);
};
//REMOVED OBJECT_ENTRY_AUTO(__uuidof(SLNKContour), CSLNKContour)

View File

@@ -64,7 +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);
[propget, id(25), helpstring("property AddContour")] HRESULT AddContour([out, retval] ISLNKContour** pVal);
};
[
object,
@@ -179,8 +179,6 @@ interface ISLNKEvent : IDispatch{
[propput, id(1), helpstring("property DwgX")] HRESULT DwgX([in] DOUBLE newVal);
[propget, id(2), helpstring("property DwgY")] HRESULT DwgY([out, retval] DOUBLE* pVal);
[propput, id(2), helpstring("property DwgY")] HRESULT DwgY([in] DOUBLE newVal);
[propget, id(7), helpstring("property ContourLabel")] HRESULT ContourLabel([out, retval] BSTR* pVal); // DEPRECATED
[propput, id(7), helpstring("property ContourLabel")] HRESULT ContourLabel([in] BSTR newVal); // DEPRECATED
[propget, id(8), helpstring("property ContourLayer")] HRESULT ContourLayer([out, retval] BSTR* pVal);
[propput, id(8), helpstring("property ContourLayer")] HRESULT ContourLayer([in] BSTR newVal);
[propget, id(9), helpstring("property TextLabel")] HRESULT TextLabel([out, retval] BSTR* pVal);
@@ -251,6 +249,7 @@ interface ISLNKContour : IDispatch{
[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);
[id(14), helpstring("property AddPoint")] HRESULT AddPoint([in] DOUBLE pValX, [in] DOUBLE pValY);
};
[
object,

View File

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

View File

@@ -31,20 +31,6 @@ STDMETHODIMP CSLNKEvent::put_DwgY(DOUBLE newVal)
return S_OK;
}
// 2.80 DEPRECATED
STDMETHODIMP CSLNKEvent::get_ContourLabel(BSTR* pVal)
{
CComBSTR bstrString(m_ContourKey);
return bstrString.CopyTo(pVal);
}
// 2.80 DEPRECATED
STDMETHODIMP CSLNKEvent::put_ContourLabel(BSTR newVal)
{
m_ContourKey = newVal;
return S_OK;
}
STDMETHODIMP CSLNKEvent::get_ContourKey(BSTR* pVal)
{
CComBSTR bstrString(m_ContourKey);

View File

@@ -79,8 +79,6 @@ public:
STDMETHOD(put_DwgX)(DOUBLE newVal);
STDMETHOD(get_DwgY)(DOUBLE* pVal);
STDMETHOD(put_DwgY)(DOUBLE newVal);
STDMETHOD(get_ContourLabel)(BSTR* pVal); // DEPRECATED 2.80
STDMETHOD(put_ContourLabel)(BSTR newVal); // DEPRECATED 2.80
STDMETHOD(get_ContourKey)(BSTR* pVal);
STDMETHOD(put_ContourKey)(BSTR newVal);
STDMETHOD(get_ContourLayer)(BSTR* pVal);

View File

@@ -35,7 +35,7 @@
// CWhipFile
const WT_Logical_Point CWhipFile::star[] =
const WT_Logical_Point CWhipFile::star[] =
{ WT_Logical_Point(-1000, 0),
WT_Logical_Point( -200, 200),
WT_Logical_Point( 0, 1000),
@@ -47,7 +47,7 @@ const WT_Logical_Point CWhipFile::star[] =
WT_Logical_Point(-1000, 0)
};
const WT_Logical_Point CWhipFile::octa[] =
const WT_Logical_Point CWhipFile::octa[] =
{ WT_Logical_Point( 1000, 414),
WT_Logical_Point( 414, 1000),
WT_Logical_Point( -414, 1000),
@@ -59,7 +59,7 @@ const WT_Logical_Point CWhipFile::octa[] =
WT_Logical_Point( 1000, 414)
};
const WT_Logical_Point CWhipFile::square[] =
const WT_Logical_Point CWhipFile::square[] =
{ WT_Logical_Point( 0, 0),
WT_Logical_Point( 0, 1000),
WT_Logical_Point( 1000, 1000),
@@ -67,6 +67,10 @@ const WT_Logical_Point CWhipFile::square[] =
WT_Logical_Point( 0, 0)
};
const WT_Logical_Point CWhipFile::empty[] = // Lege contour
{ WT_Logical_Point( INT_MAX, INT_MAX)
};
CWhipFile::CWhipFile()
{
m_FontName.set("Arial");
@@ -77,7 +81,7 @@ CWhipFile::CWhipFile()
m_reLabels.Parse(".*", FALSE);
m_reLayers.Parse(".*", FALSE);
m_hintScale = -1.0;
m_minContSize = g_SLNKOptions.m_MinContSize; // deprecated via globale setting. Later 0.20e6
m_minContSize = 0.20e6; // Minimale opp om herkend te worden.
m_forFind = TRUE; // backward compatible
m_activeLayerName = "";
@@ -90,6 +94,9 @@ CWhipFile::CWhipFile()
symb = new CSLNKSymbolDefinition(sizeof(square)/sizeof(square[0]), square);
m_SLNKSymbolDefinitions.SetAt("*SQUARE", symb);
symb = new CSLNKSymbolDefinition(sizeof(empty)/sizeof(empty[0]), empty);
m_SLNKSymbolDefinitions.SetAt("*EMPTY", symb);
}
int xxxx;
@@ -1257,15 +1264,11 @@ STDMETHODIMP CWhipFile::put_minContSize(DOUBLE newVal)
return S_OK;
}
STDMETHODIMP CWhipFile::get_AddContour(BSTR Label, BSTR Key, ISLNKContour** pVal)
STDMETHODIMP CWhipFile::get_AddContour(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);
// Je mag eigenlijk geen echt lege contour doorgeven, daar assert de pointset.cpp op?
CSLNKContourImpl *myContour = new CSLNKContourImpl(sizeof(empty)/sizeof(empty[0]), empty, WD_True, this);
myContour->m_contLabel = "Dynamic"; // Anders wordt hij niet getekend uiteindelijk
this->m_SLNKContouren.Add(myContour);

View File

@@ -62,7 +62,7 @@ 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);
STDMETHOD(get_AddContour)(ISLNKContour** pVal);
private:
@@ -159,6 +159,7 @@ private:
const static WT_Logical_Point star[];
const static WT_Logical_Point octa[];
const static WT_Logical_Point square[];
const static WT_Logical_Point empty[];
};
OBJECT_ENTRY_AUTO(__uuidof(WhipFile), CWhipFile)

View File

@@ -689,34 +689,26 @@ WT_Result CSLNKContourImpl::serialize(WT_File & file, BOOL solidOnly, BOOL forFi
return WT_Result::Success;
};
#ifndef DWFTK_READ_ONLY
void CSLNKContourImpl::serializeXML( DWFToolkit::DWFXMLSerializer& rSerializer,
WT_Units units )
throw( DWFException )
void CSLNKContourImpl::AddPoint(double pValX, double pValY, WT_Units units)
{
rSerializer.startElement( L"Contour ", L"SLNKDWF" );
rSerializer.addAttribute( L"Label", DWFString(m_contLabel) );
wchar_t zTempBuffer[32];
_DWFCORE_SWPRINTF( zTempBuffer, 32, L"%.2f", m_DWGArea );
rSerializer.addAttribute( "Area", zTempBuffer );
CString builder;
for (int i=0; i < count(); i++)
bool wasEmpty = (points()[0].m_x == INT_MAX &&
points()[0].m_y == INT_MAX);
WT_Logical_Point *pts = new WT_Logical_Point[count()+1];
int i;
for (i = 0; i < count(); i++)
{
WT_Point3D dwgPt = units.transform(points()[i]);
CString pts;
pts.Format("%.1f,%.1f", dwgPt.m_x,dwgPt.m_y);
if (builder.GetLength()>0) builder += " ";
builder = builder + pts;
pts[i] = points()[i];
}
rSerializer.addAttribute( "Points", (LPCSTR)builder );
//rSerializer.addAttribute( DWFXML::kzAttribute_Category, _zCategory );
//rSerializer.addAttribute( DWFXML::kzAttribute_Type, _zType );
//rSerializer.addAttribute( DWFXML::kzAttribute_Units, _zUnits );
// Het nieuwe punt
pts[i] = units.transform(WT_Point3D(pValX, pValY));
// Bij wasEmpty het eerste dummy punt overslaan
set(wasEmpty?1:(count() + 1), &pts[wasEmpty?1:0], true);
rSerializer.endElement();
// Na elk punt voor de zekerheid area opnieuw?
if (wasEmpty)
m_ptLabel = points()[0];
}
#endif
delete[] pts;
}

View File

@@ -66,11 +66,6 @@ public:
int l_fontheight,
double scale,
HDC myDC, int width=-2);
void AddPoint(double pValX, double pValY, WT_Units units);
static WT_Integer32 m_next_node_num;
#ifndef DWFTK_READ_ONLY
void serializeXML( DWFToolkit::DWFXMLSerializer& rSerializer,
WT_Units units )
throw( DWFException );
#endif
};

View File

@@ -1024,25 +1024,31 @@ CString CWhip2DCImpl::PolyToMap(WT_Polygon & polygon,
if (firstURL->address().length() == 0)
Href = "";
else
Href.Format("href=\"%s\"", CString(firstURL->address().ascii()));
Href.Format(" href=\"%s\"", CString(firstURL->address().ascii()));
if (firstURL->friendly_name().is_ascii())
ttl = firstURL->friendly_name().ascii();
else
ttl = CStringW(firstURL->friendly_name().unicode());
}
else
ttl = objKey; // Is dit wel zo logisch/wenselijk?
//else
// ttl = objKey; // Is dit wel zo logisch/wenselijk?
ttl.Replace("\\n", "\n");
Title.Format("title=\"%s\"", ttl);
CString smbl = "";
if (m_State->bIsSymbolLayer && objKey != "")
smbl.Format("\nSLNKSymbolKey=\"%s\"", objKey);
if (objKey != "")
{
// SLNKSymbolKey voor FACILITOR 5.3.1 backward compatible
if (m_State->bIsSymbolLayer)
smbl.Format(" SLNKSymbolKey=\"%s\" SLNKKey=\"%s\"", objKey, objKey);
else
smbl.Format(" SLNKKey=\"%s\"", objKey);
}
CString Builder;
Builder.Format("\n<area shape=\"%s\"\n%s\n%s\n%s%s>",
shape, Coords, Title, Href, smbl);
Builder.Format("\n<area%s %s shape=\"%s\" %s%s>",
smbl, Title, shape, Coords, Href);
return Builder;
};