[mapguide-commits] r1265 - trunk/MgDev/Common/Stylization
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Mar 16 17:45:44 EDT 2007
Author: traianstanev
Date: 2007-03-16 17:45:44 -0400 (Fri, 16 Mar 2007)
New Revision: 1265
Modified:
trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.h
trunk/MgDev/Common/Stylization/StylizationEngine.cpp
trunk/MgDev/Common/Stylization/StylizationEngine.h
Log:
After the SE_Style cleanup, it was no longer necessary for styles and primitives to know their own type, since type casting is no longer needed. Also got rid of a repeated dynamic_cast in StylizationEngine.
Modified: trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.h
===================================================================
--- trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.h 2007-03-16 21:27:39 UTC (rev 1264)
+++ trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.h 2007-03-16 21:45:44 UTC (rev 1265)
@@ -30,23 +30,6 @@
//
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-enum SE_PrimitiveType
-{
- SE_PolylinePrimitive,
- SE_PolygonPrimitive,
- SE_TextPrimitive,
- SE_RasterPrimitive
-};
-
-
-enum SE_StyleType
-{
- SE_PointStyleType,
- SE_LineStyleType,
- SE_AreaStyleType
-};
-
class RS_FilterExecutor;
class RS_FontEngine;
class SE_SymbolManager;
@@ -71,7 +54,6 @@
struct SE_Primitive
{
- SE_PrimitiveType type;
GraphicElement::ResizeControl resize;
bool cacheable;
@@ -89,7 +71,7 @@
SE_Color color;
SE_Boolean weightScalable;
- SE_INLINE SE_Polyline() : weight(0.0) { type = SE_PolylinePrimitive; }
+ SE_INLINE SE_Polyline() : weight(0.0) { }
~SE_Polyline() { geometry->Free(); }
virtual SE_RenderPrimitive* evaluate(SE_EvalContext*);
};
@@ -99,8 +81,6 @@
{
SE_Color fill;
- SE_INLINE SE_Polygon() { type = SE_PolygonPrimitive; weight = 0.0; }
- virtual ~SE_Polygon() { }
virtual SE_RenderPrimitive* evaluate(SE_EvalContext*);
};
@@ -123,7 +103,6 @@
SE_Color textColor;
SE_Color ghostColor;
- SE_INLINE SE_Text() { type = SE_TextPrimitive; }
virtual SE_RenderPrimitive* evaluate(SE_EvalContext*);
};
@@ -137,7 +116,7 @@
SE_Double extent[2];
SE_Double angle;
- SE_INLINE SE_Raster() { type = SE_RasterPrimitive; }
+ SE_INLINE SE_Raster() { }
virtual SE_RenderPrimitive* evaluate(SE_EvalContext*);
};
@@ -153,7 +132,6 @@
struct SE_Style
{
SE_RenderStyle* rstyle; // cached evaluated RenderStyle
- SE_StyleType type;
SE_PrimitiveList symbol;
SE_Integer renderPass;
@@ -162,7 +140,7 @@
SE_Double resizeSize[2];
ResizeBox::GrowControl resize;
- SE_INLINE SE_Style(SE_StyleType stype) : type(stype), rstyle(NULL) { }
+ SE_INLINE SE_Style() : rstyle(NULL) { }
virtual ~SE_Style();
@@ -177,7 +155,7 @@
SE_Double angle;
SE_Double originOffset[2];
- SE_INLINE SE_PointStyle() : SE_Style(SE_PointStyleType) { }
+ SE_INLINE SE_PointStyle() { }
virtual void apply(LineBuffer* geometry, SE_Renderer* renderer);
virtual void evaluate(SE_EvalContext*);
};
@@ -196,7 +174,7 @@
SE_Double repeat;
SE_Double vertexAngleLimit;
- SE_INLINE SE_LineStyle() : SE_Style(SE_LineStyleType) { }
+ SE_INLINE SE_LineStyle() { }
virtual void apply(LineBuffer* geometry, SE_Renderer* renderer);
virtual void evaluate(SE_EvalContext*);
};
@@ -213,7 +191,7 @@
SE_Double repeat[2];
SE_Double bufferWidth;
- SE_INLINE SE_AreaStyle() : SE_Style(SE_AreaStyleType) { }
+ SE_INLINE SE_AreaStyle() { }
virtual void apply(LineBuffer* geometry, SE_Renderer* renderer);
virtual void evaluate(SE_EvalContext*);
};
Modified: trunk/MgDev/Common/Stylization/StylizationEngine.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/StylizationEngine.cpp 2007-03-16 21:27:39 UTC (rev 1264)
+++ trunk/MgDev/Common/Stylization/StylizationEngine.cpp 2007-03-16 21:45:44 UTC (rev 1265)
@@ -68,6 +68,8 @@
if (reader == NULL || executor == NULL)
return;
+ m_renderer = renderer;
+
// make sure we have an SE renderer
// TODO: eliminate the need to do dynamic casts on these renderers. We should
// probably ultimately have just one renderer interface class...
@@ -240,19 +242,13 @@
// only call StartFeature for the initial rendering pass
if (renderingPass == 0)
{
- // TODO: eliminate the need to do dynamic casts on these renderers. We should
- // probably ultimately have just one renderer interface class...
- Renderer* renderer = dynamic_cast<Renderer*>(m_serenderer);
- if (renderer)
- {
- const wchar_t* strTip = seTip->evaluate(executor);
- const wchar_t* strUrl = seUrl->evaluate(executor);
- RS_String rs_tip = strTip? strTip : L"";
- RS_String rs_url = strUrl? strUrl : L"";
- RS_String& rs_thm = rule->legendLabel;
+ const wchar_t* strTip = seTip->evaluate(executor);
+ const wchar_t* strUrl = seUrl->evaluate(executor);
+ RS_String rs_tip = strTip? strTip : L"";
+ RS_String rs_url = strUrl? strUrl : L"";
+ RS_String& rs_thm = rule->legendLabel;
- renderer->StartFeature(reader, rs_tip.empty()? NULL : &rs_tip, rs_url.empty()? NULL : &rs_url, rs_thm.empty()? NULL : &rs_thm);
- }
+ m_renderer->StartFeature(reader, rs_tip.empty()? NULL : &rs_tip, rs_url.empty()? NULL : &rs_url, rs_thm.empty()? NULL : &rs_thm);
}
/* TODO: Obey the indices--Get rid of the indices altogther--single pass! */
@@ -328,6 +324,7 @@
}
else
{
+ //apply the style to the geometry using the renderer
style->apply(geometry, m_serenderer);
}
}
Modified: trunk/MgDev/Common/Stylization/StylizationEngine.h
===================================================================
--- trunk/MgDev/Common/Stylization/StylizationEngine.h 2007-03-16 21:27:39 UTC (rev 1264)
+++ trunk/MgDev/Common/Stylization/StylizationEngine.h 2007-03-16 21:45:44 UTC (rev 1265)
@@ -27,6 +27,7 @@
class SE_LineBuffer;
class SE_LineBufferPool;
class SE_Renderer;
+class Renderer;
class SE_StyleVisitor;
class LineBuffer;
class LineBufferPool;
@@ -85,6 +86,7 @@
private:
SE_Renderer* m_serenderer;
+ Renderer* m_renderer;
SE_SymbolManager* m_resources;
SE_LineBufferPool* m_pool;
SE_StyleVisitor* m_visitor;
More information about the mapguide-commits
mailing list