Whipfile.DefineW2DSymbol zodat je symbolen op basis van W2D files kunt definiëren.

svn path=/Slnkdwf/trunk/; revision=18501
This commit is contained in:
Jos Groot Lipman
2013-07-18 19:35:14 +00:00
parent 7f586d9727
commit 283afe654f
5 changed files with 38 additions and 1 deletions

View File

@@ -53,6 +53,7 @@ interface IWhipFile : IDispatch{
[id(12), helpstring("method SetLayers")] HRESULT SetLayers([in] BSTR reContouren, [in] BSTR reLabels);
[propget, id(14), helpstring("property AddSymbol")] HRESULT AddSymbol([in] DOUBLE dwgX, [in] DOUBLE dwgY, BSTR symbolName, [out, retval] ISLNKSymbol** pVal);
[id(15), helpstring("method DefineSymbol")] HRESULT DefineSymbol([in] BSTR symbolName, [in] VARIANT EPlotStream, [out, retval] ISLNKContour** pContour);
[id(26), helpstring("method DefineW2DSymbol")] HRESULT DefineW2DSymbol([in] BSTR symbolName, [in] BSTR W2Dfilepath, [out, retval] ISLNKContour** pContour);
[id(16), helpstring("method DefineBitmapSymbol")] HRESULT DefineBitmapSymbol([in] BSTR symbolName, [in] BSTR symbolPath, [in] DOUBLE height);
[propget, id(17), helpstring("property Contour")] HRESULT Contour([in] BSTR IdentLabel, [out, retval] ISLNKContour** pVal);
[id(18), helpstring("method SetFilterLayers")] HRESULT SetFilterLayers([in] BSTR reLayers);

View File

@@ -23,6 +23,20 @@ CSLNKSymbolDefinition::CSLNKSymbolDefinition(CComQIPtr<IEPlotSection> EPlotSecti
m_Origin = CSLNKContourImpl::Centroid(m_BoundingContour);
};
// Define symbol by W2D path name
CSLNKSymbolDefinition::CSLNKSymbolDefinition(CString W2Dfilepath)
{
m_wtFile.set_filename(W2Dfilepath);
m_AsBitmap = NULL;
m_BuiltIn = false;
m_hasBitmap = false;
calculateBoundary(m_BoundingContour); // rekent ook BoundingContour.m_Units van het symbool uit
m_Origin = CSLNKContourImpl::Centroid(m_BoundingContour);
};
// Bij Contour list (builtin symbol)
CSLNKSymbolDefinition::CSLNKSymbolDefinition(int count, WT_Logical_Point const *points, WT_Units units)
{
@@ -107,7 +121,7 @@ WT_Result CSLNKSymbolDefinition::calculateBoundary (CSLNKContourImpl &BoundingCo
m_wtFile.set_file_mode(WT_File::File_Read);
result = m_wtFile.open();
if (result != WT_Result::Success)
return result;
throw myCString("ERROR: Unable to open symbol file");
if (tm != NULL)
{

View File

@@ -8,6 +8,7 @@ class CSLNKSymbolDefinition
{
public:
CSLNKSymbolDefinition(CComQIPtr<IEPlotSection> EPlotSection);
CSLNKSymbolDefinition(CString W2Dfilepath);
CSLNKSymbolDefinition(int count, WT_Logical_Point const *points, WT_Units units);
CSLNKSymbolDefinition(CString const filepath, double const height, WT_Units units);
~CSLNKSymbolDefinition(void);

View File

@@ -1140,6 +1140,26 @@ STDMETHODIMP CWhipFile::DefineSymbol(BSTR symbolName, VARIANT EPlotStream, ISLNK
return return_ContourItem(&symb->m_BoundingContour, pContour); // Geef de contour terug in pcontour
}
// Define symbol by W2D filename
STDMETHODIMP CWhipFile::DefineW2DSymbol(BSTR symbolName, BSTR WhipPath, ISLNKContour** pContour)
{
myTRACE("\nDefining symbol %ls by W2D file %ls", symbolName, WhipPath);
CSLNKSymbolDefinition * symb;
try
{
symb = new CSLNKSymbolDefinition(CString(WhipPath));
}
catch (CString &err)
{
return myAtlReportError (GetObjectCLSID(), "Error defining symbol %ls file %ls:%s\n", symbolName, WhipPath, err);
}
m_SLNKSymbolDefinitions.SetAt(CString(symbolName), symb);
return return_ContourItem(&symb->m_BoundingContour, pContour); // Geef de contour terug in pcontour
}
STDMETHODIMP CWhipFile::DefineBitmapSymbol(BSTR symbolName, BSTR symbolPath, double height)
{
myTRACE("\nDefining bitmap symbol %ls", symbolName);

View File

@@ -58,6 +58,7 @@ public:
STDMETHOD(SetLabelPosition)(BYTE LabelPos);
STDMETHOD(get_AddSymbol)(DOUBLE dwgX, DOUBLE dwgY, BSTR symbolName, ISLNKSymbol** pVal);
STDMETHOD(DefineSymbol)(BSTR symbolName, VARIANT EPlotStream, ISLNKContour** pContour);
STDMETHOD(DefineW2DSymbol)(BSTR symbolName, BSTR WhipPath, ISLNKContour** pContour);
STDMETHOD(DefineBitmapSymbol)(BSTR symbolName, BSTR symbolPath, DOUBLE height);
STDMETHOD(get_Contour)(BSTR IdentLabel, ISLNKContour** pVal);
STDMETHOD(SetFilterLayers)(BSTR reLayers);