[mapguide-commits] r5145 - in trunk/MgDev:
Common/PlatformBase/Services Common/Renderers
Common/Stylization Server/src/Services/Rendering
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Sep 17 15:02:45 EDT 2010
Author: waltweltonlair
Date: 2010-09-17 19:02:45 +0000 (Fri, 17 Sep 2010)
New Revision: 5145
Modified:
trunk/MgDev/Common/PlatformBase/Services/ResourceDefs.h
trunk/MgDev/Common/Renderers/DWFRenderer.cpp
trunk/MgDev/Common/Renderers/KmlRenderer.cpp
trunk/MgDev/Common/Renderers/RenderUtil.cpp
trunk/MgDev/Common/Renderers/RenderUtil.h
trunk/MgDev/Common/Stylization/DefaultStylizer.cpp
trunk/MgDev/Common/Stylization/SE_PositioningAlgorithms.cpp
trunk/MgDev/Common/Stylization/SE_Renderer.cpp
trunk/MgDev/Common/Stylization/SE_Renderer.h
trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.cpp
trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.h
trunk/MgDev/Common/Stylization/StylizationEngine.cpp
trunk/MgDev/Server/src/Services/Rendering/FeatureInfoRenderer.cpp
Log:
Additional watermark cleanup
* Change the opacity memeber in SE_Raster to a raw double and not an SE_Double. The latter supports expressions, which are not needed for the opacity.
* Add TODO comment about cleanup of StylizationEngine::StylizeWatermark
* Some minor formatting
Modified: trunk/MgDev/Common/PlatformBase/Services/ResourceDefs.h
===================================================================
--- trunk/MgDev/Common/PlatformBase/Services/ResourceDefs.h 2010-09-17 18:07:29 UTC (rev 5144)
+++ trunk/MgDev/Common/PlatformBase/Services/ResourceDefs.h 2010-09-17 19:02:45 UTC (rev 5145)
@@ -287,7 +287,7 @@
/// This resource is a watermark definition.
///
/// \remarks
- /// It represents the watermark rendered in map.
+ /// It represents the watermark rendered in a map.
///
/// \see \ref WatermarkDefinition_schema "WatermarkDefinition schema"
///
Modified: trunk/MgDev/Common/Renderers/DWFRenderer.cpp
===================================================================
--- trunk/MgDev/Common/Renderers/DWFRenderer.cpp 2010-09-17 18:07:29 UTC (rev 5144)
+++ trunk/MgDev/Common/Renderers/DWFRenderer.cpp 2010-09-17 19:02:45 UTC (rev 5145)
@@ -2712,10 +2712,11 @@
}
}
+
void DWFRenderer::DrawScreenRaster(unsigned char* data, int length,
- RS_ImageFormat format, int native_width, int native_height,
- double x, double y, double w, double h, double angleDeg,
- double alpha)
+ RS_ImageFormat format, int native_width, int native_height,
+ double x, double y, double w, double h, double angleDeg,
+ double alpha)
{
RenderUtil::DrawScreenRaster(this, data, length, format, native_width, native_height,
x, y, w, h, angleDeg, alpha);
Modified: trunk/MgDev/Common/Renderers/KmlRenderer.cpp
===================================================================
--- trunk/MgDev/Common/Renderers/KmlRenderer.cpp 2010-09-17 18:07:29 UTC (rev 5144)
+++ trunk/MgDev/Common/Renderers/KmlRenderer.cpp 2010-09-17 19:02:45 UTC (rev 5145)
@@ -674,10 +674,11 @@
{
}
+
void KmlRenderer::DrawScreenRaster(unsigned char* data, int length,
- RS_ImageFormat format, int native_width, int native_height,
- double x, double y, double w, double h, double angleDeg,
- double alpha)
+ RS_ImageFormat format, int native_width, int native_height,
+ double x, double y, double w, double h, double angleDeg,
+ double alpha)
{
RenderUtil::DrawScreenRaster(this, data, length, format, native_width, native_height,
x, y, w, h, angleDeg, alpha);
Modified: trunk/MgDev/Common/Renderers/RenderUtil.cpp
===================================================================
--- trunk/MgDev/Common/Renderers/RenderUtil.cpp 2010-09-17 18:07:29 UTC (rev 5144)
+++ trunk/MgDev/Common/Renderers/RenderUtil.cpp 2010-09-17 19:02:45 UTC (rev 5145)
@@ -1,5 +1,5 @@
//
-// Copyright (C) 2007-2010 by Autodesk, Inc.
+// Copyright (C) 2010 by Autodesk, Inc.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of version 2.1 of the GNU Lesser
@@ -29,13 +29,12 @@
if (format == RS_ImageFormat_Unknown)
return;
- if(alpha <= 0) return;
+ if (alpha <= 0.0)
+ return;
- if(alpha >=1)
+ if (alpha >= 1.0)
{
- render->DrawScreenRaster(
- data, length, format, native_width, native_height,
- x, y, w, h, angledeg);
+ render->DrawScreenRaster(data, length, format, native_width, native_height, x, y, w, h, angledeg);
return;
}
@@ -58,21 +57,17 @@
delete [] decoded;
}
- else if(format == RS_ImageFormat_ABGR || format == RS_ImageFormat_ARGB)
+ else if (format == RS_ImageFormat_ABGR || format == RS_ImageFormat_ARGB)
{
- //Set alpha value for each pixel
+ // set alpha value for each pixel
unsigned char* end = data + 4 * native_width * native_height;
- for(unsigned char* pixel = data; pixel < end; pixel += 4)
+ for (unsigned char* pixel = data; pixel < end; pixel += 4)
pixel[3] = (unsigned char)((float)pixel[3] * (float)alpha);
- render->DrawScreenRaster(
- data, length, format, native_width, native_height,
- x, y, w, h, angledeg);
+ render->DrawScreenRaster(data, length, format, native_width, native_height, x, y, w, h, angledeg);
}
else
{
- //TODO: Set alpha for other format
- render->DrawScreenRaster(
- data, length, format, native_width, native_height,
- x, y, w, h, angledeg);
+ // TODO: set alpha for other format
+ render->DrawScreenRaster(data, length, format, native_width, native_height, x, y, w, h, angledeg);
}
}
Modified: trunk/MgDev/Common/Renderers/RenderUtil.h
===================================================================
--- trunk/MgDev/Common/Renderers/RenderUtil.h 2010-09-17 18:07:29 UTC (rev 5144)
+++ trunk/MgDev/Common/Renderers/RenderUtil.h 2010-09-17 19:02:45 UTC (rev 5145)
@@ -1,5 +1,5 @@
//
-// Copyright (C) 2007-2010 by Autodesk, Inc.
+// Copyright (C) 2010 by Autodesk, Inc.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of version 2.1 of the GNU Lesser
@@ -24,7 +24,6 @@
class RenderUtil
{
-
public:
// Draw screen raster with alpha
// Alpha is a value between 0 and 1.
Modified: trunk/MgDev/Common/Stylization/DefaultStylizer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/DefaultStylizer.cpp 2010-09-17 18:07:29 UTC (rev 5144)
+++ trunk/MgDev/Common/Stylization/DefaultStylizer.cpp 2010-09-17 19:02:45 UTC (rev 5145)
@@ -228,6 +228,8 @@
m_styleEngine->ClearCache();
}
+
+//////////////////////////////////////////////////////////////////////////////
void DefaultStylizer::StylizeWatermark(Renderer* renderer,
MdfModel::WatermarkDefinition* watermark,
INT32 drawWidth,
Modified: trunk/MgDev/Common/Stylization/SE_PositioningAlgorithms.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_PositioningAlgorithms.cpp 2010-09-17 18:07:29 UTC (rev 5144)
+++ trunk/MgDev/Common/Stylization/SE_PositioningAlgorithms.cpp 2010-09-17 19:02:45 UTC (rev 5145)
@@ -503,6 +503,9 @@
RS_FeatureReader* featureReader,
SE_SymbolManager* symbolManager)
{
+ if (featureReader == NULL)
+ return;
+
SE_Renderer* se_renderer = applyCtx->renderer;
LineBuffer* geometry = applyCtx->geometry;
Modified: trunk/MgDev/Common/Stylization/SE_Renderer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_Renderer.cpp 2010-09-17 18:07:29 UTC (rev 5144)
+++ trunk/MgDev/Common/Stylization/SE_Renderer.cpp 2010-09-17 19:02:45 UTC (rev 5145)
@@ -673,6 +673,7 @@
return ret;
}
+
//////////////////////////////////////////////////////////////////////////////
// Indicates whether rendering optimization is used by this renderer. For example, if we are rendering text and
// optimization is turned on, then text is rendered as a simple line when it is very small.
Modified: trunk/MgDev/Common/Stylization/SE_Renderer.h
===================================================================
--- trunk/MgDev/Common/Stylization/SE_Renderer.h 2010-09-17 18:07:29 UTC (rev 5144)
+++ trunk/MgDev/Common/Stylization/SE_Renderer.h 2010-09-17 19:02:45 UTC (rev 5145)
@@ -87,8 +87,7 @@
virtual void DrawScreenRaster(unsigned char* data, int length,
RS_ImageFormat format, int native_width, int native_height,
double x, double y, double w, double h, double angleDeg) = 0;
- // Draw screen raster with alpha
- // Alpha is a value between 0 and 1.
+ // Draw screen raster with alpha. Alpha is a value between 0 and 1.
// 0 means completely transparent, while 1 means completely opaque.
virtual void DrawScreenRaster(unsigned char* data, int length,
RS_ImageFormat format, int native_width, int native_height,
Modified: trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.cpp 2010-09-17 18:07:29 UTC (rev 5144)
+++ trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.cpp 2010-09-17 19:02:45 UTC (rev 5145)
@@ -527,7 +527,8 @@
ret->angleRad = fmod(angleDeg.evaluate(ctx->exec), 360.0) * M_PI180;
- ret->opacity = opacity.evaluate(ctx->exec);
+ // this one is just a raw double
+ ret->opacity = opacity;
SE_Matrix rxf;
rxf.rotate(ret->angleRad);
Modified: trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.h
===================================================================
--- trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.h 2010-09-17 18:07:29 UTC (rev 5144)
+++ trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.h 2010-09-17 19:02:45 UTC (rev 5145)
@@ -150,12 +150,10 @@
SE_Double extent[2];
SE_Boolean sizeScalable;
SE_Double angleDeg; // degrees CCW
- SE_Double opacity;
+ double opacity;
- SE_INLINE SE_Raster() : ownPtr(false)
- {
- opacity.value = opacity.defValue = 1;
- }
+ SE_INLINE SE_Raster() : ownPtr(false), opacity(1.0)
+ {}
~SE_Raster()
{
Modified: trunk/MgDev/Common/Stylization/StylizationEngine.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/StylizationEngine.cpp 2010-09-17 18:07:29 UTC (rev 5144)
+++ trunk/MgDev/Common/Stylization/StylizationEngine.cpp 2010-09-17 19:02:45 UTC (rev 5145)
@@ -199,6 +199,7 @@
#endif
}
+
// opaque is a double between 0 and 1.
// 0 means totally transparent, while 1 means totally opaque.
// The caller should be responsible for validating opaque value.
@@ -209,6 +210,7 @@
| (((unsigned int)(((argb >> 24) & 0xFF)* opaque)) << 24);
}
+
// Unit can't be Pixels.
// The caller should be responsible for not input pixel
inline double GetUnitPerMeter(WatermarkOffset::WatermarkOffsetUnit unit)
@@ -233,6 +235,10 @@
}
}
+
+// THIS METHOD NEEDS TO BE CLEANED UP
+// ** unnecessary object creation using new (allocated n the stack instead)
+// ** compiler warnings being generated
void StylizationEngine::StylizeWatermark(SE_Renderer* se_renderer,
WatermarkDefinition* watermark,
INT32 drawWidth,
@@ -255,16 +261,16 @@
std::auto_ptr<SE_Rule> rule(new SE_Rule());
- //Translate watermark source into SE_SymbolInstance list.
- //As the source is adopted into symbol, we need to detach them after the rendering is done.
- std::auto_ptr<CompositeSymbolization> symbols(new CompositeSymbolization());
+ // Translate watermark source into SE_SymbolInstance list.
+ // As the source is adopted into symbol, we need to detach them after the rendering is done.
+ CompositeSymbolization symbols;
std::auto_ptr<SymbolInstance> instance(new SymbolInstance());
instance->AdoptSymbolDefinition(watermark->GetSource());
instance->SetUsageContext(SymbolInstance::ucPoint);
- symbols->GetSymbolCollection()->Adopt(instance.release());
+ symbols.GetSymbolCollection()->Adopt(instance.release());
- m_visitor->Convert(rule->symbolInstances, symbols.get());
+ m_visitor->Convert(rule->symbolInstances, &symbols);
_ASSERT(rule->symbolInstances.size() == 1u);
// Translate appearance (transparency / rotation) into symbol instance
@@ -316,7 +322,7 @@
}
else if(rasterPri)
{
- rasterPri->opacity.value = rasterPri->opacity.defValue = opacity;
+ rasterPri->opacity = opacity;
}
}
}
@@ -746,10 +752,11 @@
// Detach symbol definition from the created composite symbol so that
// it will not be finalized when composite symbol is finalized.
// The code is sure there is only one symbol instance.
- _ASSERT(symbols->GetSymbolCollection()->GetCount() == 1);
- symbols->GetSymbolCollection()->GetAt(0)->OrphanSymbolDefinition();
+ _ASSERT(symbols.GetSymbolCollection()->GetCount() == 1);
+ symbols.GetSymbolCollection()->GetAt(0)->OrphanSymbolDefinition();
}
+
void StylizationEngine::Stylize(RS_FeatureReader* reader,
FdoExpressionEngine* exec,
LineBuffer* geometry,
@@ -1348,10 +1355,7 @@
}
else if (wcscmp(positioningAlgo, L"MultipleHighwayShields") == 0)
{
- if(m_reader)
- {
- SE_PositioningAlgorithms::MultipleHighwaysShields(applyCtx, rstyle, mm2su, m_reader, m_resources);
- }
+ SE_PositioningAlgorithms::MultipleHighwaysShields(applyCtx, rstyle, mm2su, m_reader, m_resources);
}
else if (wcscmp(positioningAlgo, L"Default") == 0)
{
Modified: trunk/MgDev/Server/src/Services/Rendering/FeatureInfoRenderer.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/FeatureInfoRenderer.cpp 2010-09-17 18:07:29 UTC (rev 5144)
+++ trunk/MgDev/Server/src/Services/Rendering/FeatureInfoRenderer.cpp 2010-09-17 19:02:45 UTC (rev 5145)
@@ -287,10 +287,11 @@
}
}
+
void FeatureInfoRenderer::DrawScreenRaster(unsigned char* data, int length,
- RS_ImageFormat format, int native_width, int native_height,
- double x, double y, double w, double h, double angleDeg,
- double alpha)
+ RS_ImageFormat format, int native_width, int native_height,
+ double x, double y, double w, double h, double angleDeg,
+ double alpha)
{
DrawScreenRaster(data, length, format, native_width, native_height, x, y, w, h, angleDeg);
}
More information about the mapguide-commits
mailing list