[mapguide-commits] r4300 - sandbox/rfc60/MgDev/Common/MdfModel
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Oct 16 18:57:39 EDT 2009
Author: uvlite
Date: 2009-10-16 18:57:39 -0400 (Fri, 16 Oct 2009)
New Revision: 4300
Modified:
sandbox/rfc60/MgDev/Common/MdfModel/VectorScaleRange.cpp
Log:
RFC60 added code to extract colors from labels and recognize Composite textures
Modified: sandbox/rfc60/MgDev/Common/MdfModel/VectorScaleRange.cpp
===================================================================
--- sandbox/rfc60/MgDev/Common/MdfModel/VectorScaleRange.cpp 2009-10-16 18:12:30 UTC (rev 4299)
+++ sandbox/rfc60/MgDev/Common/MdfModel/VectorScaleRange.cpp 2009-10-16 22:57:39 UTC (rev 4300)
@@ -182,19 +182,28 @@
Rule* rule = ruleColl->GetAt(k);
// get the label which will be the key in the color map
- const MdfString& label = rule->GetLegendLabel();
+ Label* label = rule->GetLabel();
+ // the legend label is just a string
+ // const MdfString& legendLabel = rule->GetLegendLabel();
+ // add colors of txtsymbols
+ TextSymbol* txtsym = label->GetSymbol();
+ if (txtsym) {
+ usedColorList->push_back(txtsym->GetForegroundColor().substr());
+ usedColorList->push_back(txtsym->GetBackgroundColor().substr());
+ }
// do the casting to access the relevant members
// this is bad style (instead of virtual functions GetColors() in each subclass)
// but we save touching too many different files
AreaRule* paRule = dynamic_cast<AreaRule*>(rule);
LineRule* plRule = dynamic_cast<LineRule*>(rule);
PointRule* ppRule = dynamic_cast<PointRule*>(rule);
- //CompositeRule* pcRule = dynamic_cast<CompositeRule*>(rule); // no colors in there
+ CompositeRule* pcRule = dynamic_cast<CompositeRule*>(rule); // used for new stylization
// AreaRule Symbolization.....
if (paRule != NULL)
- { AreaSymbolization2D* pasym = paRule->GetSymbolization();
+ {
+ AreaSymbolization2D* pasym = paRule->GetSymbolization();
if (pasym->GetFill() != NULL)
{ // create copies of all strings!!! so we can safely delete the resulting list later
usedColorList->push_back(pasym->GetFill()->GetForegroundColor().substr());
@@ -260,7 +269,43 @@
}
} // if pointSymbolization
} // end pointRule
+ // CompositeRule Symbolization.....
+ if (pcRule != NULL)
+ {
+ CompositeSymbolization* pcsym = pcRule->GetSymbolization();
+ SymbolInstanceCollection* sic = pcsym->GetSymbolCollection();
+ int nInstances = sic->GetCount();
+ for (int i=0; i<nInstances; ++i)
+ {
+ SymbolInstance* instance = sic->GetAt(i);
+ bool isRef = false;
+ // get the symbol definition, either inlined or by reference
+ SymbolDefinition* symdef = instance->GetSymbolDefinition();
+ if (symdef == NULL)
+ {
+ /// CHECK resource service
+ const MdfString& ref = instance->GetResourceId(); // symbol reference
+#ifdef _DEBUG
+ printf("\n\nGetUserColorList(): found ResourceId %s\n\n", ref.c_str());
+#endif
+
+// symdef = m_resources->GetSymbolDefinition(ref.c_str());
+// if (symdef == NULL) continue;
+// isRef = true;
+ // remember the current symbol resource id in case it references
+ // an attached png image resource
+// m_resIdStack.push_back(ref.c_str());
+ } else
+ {
+ const MdfString& desc = symdef->GetDescription();
+#ifdef _DEBUG
+ printf("\n\nGetUserColorList(): found Symbol %s\n\n", desc.c_str());
+#endif
+ }
+// if (isRef) m_resIdStack.pop_back();
+ } // for sym instances
+ } // for CompositeRule
} // for GetRules
} // for GetFeatureTypeStyles
return this->m_usedColorList;
More information about the mapguide-commits
mailing list