[mapguide-commits] r10055 - in sandbox/adsk/trunk/Common: MdfModel MdfParser Stylization

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Jul 26 18:36:56 PDT 2023


Author: simonliu
Date: 2023-07-26 18:36:54 -0700 (Wed, 26 Jul 2023)
New Revision: 10055

Modified:
   sandbox/adsk/trunk/Common/MdfModel/Rule.cpp
   sandbox/adsk/trunk/Common/MdfModel/Rule.h
   sandbox/adsk/trunk/Common/MdfParser/IOCompositeRule.cpp
   sandbox/adsk/trunk/Common/Stylization/SE_SymbolDefProxies.h
   sandbox/adsk/trunk/Common/Stylization/StylizationEngine.cpp
Log:
Add a new flag Active to CompositeRule. Features met the Filter criteria of the rule will be stylized if Active is true. Otherwise the features will not be stylized. The default value is true.

Modified: sandbox/adsk/trunk/Common/MdfModel/Rule.cpp
===================================================================
--- sandbox/adsk/trunk/Common/MdfModel/Rule.cpp	2023-07-12 10:48:11 UTC (rev 10054)
+++ sandbox/adsk/trunk/Common/MdfModel/Rule.cpp	2023-07-27 01:36:54 UTC (rev 10055)
@@ -33,6 +33,7 @@
 Rule::Rule()
 {
     this->m_pLabel = new Label();
+    this->m_active = true;
 }
 
 //-------------------------------------------------------------------------
@@ -141,3 +142,26 @@
     this->m_pLabel = NULL;
     return ret;
 }
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the Active Property defined in this Rule.
+//          Indicates whether the Rule is active. Features met the Filter criteria will
+//          be stylized if Active is true. Otherwise the features will not be stylized.
+// RETURNS: True if the rule is active. Otherwise false.
+//-------------------------------------------------------------------------
+const bool Rule::GetActive() const
+{
+    return m_active;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method to the Actvie Property defined in this Rule.
+//          Indicates whether the Rule is active. Features met the Filter criteria will
+//          be stylized if Active is true. Otherwise the features will not be stylized.
+// PARAMETERS:
+//      Input:
+//          isActive - The Active boolean value.
+void Rule::SetActive(bool isActive)
+{
+    m_active = isActive;
+}

Modified: sandbox/adsk/trunk/Common/MdfModel/Rule.h
===================================================================
--- sandbox/adsk/trunk/Common/MdfModel/Rule.h	2023-07-12 10:48:11 UTC (rev 10054)
+++ sandbox/adsk/trunk/Common/MdfModel/Rule.h	2023-07-27 01:36:54 UTC (rev 10055)
@@ -65,6 +65,9 @@
         void AdoptLabel(Label* pLabel);
         Label* OrphanLabel();
 
+        const bool GetActive() const;
+        void SetActive(bool isActive);
+
     protected:
         // Construction, initialization
         // Default constructor is protected to make this class abstract.
@@ -83,6 +86,9 @@
 
         // Label for multivariate theming.
         Label* m_pLabel;
+
+        // Indicates whether the rule is active.
+        bool m_active;
     };
 
     typedef MdfOwnerCollection<Rule> RuleCollection;

Modified: sandbox/adsk/trunk/Common/MdfParser/IOCompositeRule.cpp
===================================================================
--- sandbox/adsk/trunk/Common/MdfParser/IOCompositeRule.cpp	2023-07-12 10:48:11 UTC (rev 10054)
+++ sandbox/adsk/trunk/Common/MdfParser/IOCompositeRule.cpp	2023-07-27 01:36:54 UTC (rev 10055)
@@ -66,6 +66,11 @@
 {
          IF_STRING_PROPERTY(this->m_currElemName, this->m_compositeRule, LegendLabel, ch)
     else IF_STRING_PROPERTY(this->m_currElemName, this->m_compositeRule, Filter, ch)
+
+        else if (this->m_currElemName == L"Active")     // NOXLATE
+        {
+            this->m_compositeRule->SetActive(wstrToBool(ch));
+        }
 }
 
 
@@ -97,6 +102,15 @@
     EMIT_STRING_PROPERTY(fd, compositeRule, LegendLabel, false, NULL, tab)
     EMIT_STRING_PROPERTY(fd, compositeRule, Filter, true, L"", tab) // default is empty string
 
+    // Active is an optional element. The default value is true.
+    // Write Active only when it is false.
+    if (!compositeRule->GetActive())
+    {
+        fd << tab.tab() << startStr("Active");           // NOXLATE
+        fd << BoolToStr(compositeRule->GetActive());
+        fd << endStr("Active") << std::endl;             // NOXLATE
+    }
+
     IOCompositeSymbolization::Write(fd, compositeRule->GetSymbolization(), version, tab);
 
     // Write any unknown XML / extended data

Modified: sandbox/adsk/trunk/Common/Stylization/SE_SymbolDefProxies.h
===================================================================
--- sandbox/adsk/trunk/Common/Stylization/SE_SymbolDefProxies.h	2023-07-12 10:48:11 UTC (rev 10054)
+++ sandbox/adsk/trunk/Common/Stylization/SE_SymbolDefProxies.h	2023-07-27 01:36:54 UTC (rev 10055)
@@ -287,8 +287,9 @@
     std::vector<SE_SymbolInstance*> symbolInstances;
     RS_String legendLabel;  // no expressions on this guy?
     FdoFilter* filter;
+    bool active;            // indicates whether the rule is active.
 
-    SE_Rule() : filter(NULL)
+    SE_Rule() : filter(NULL), active(true)
     {}
 
     ~SE_Rule()

Modified: sandbox/adsk/trunk/Common/Stylization/StylizationEngine.cpp
===================================================================
--- sandbox/adsk/trunk/Common/Stylization/StylizationEngine.cpp	2023-07-12 10:48:11 UTC (rev 10054)
+++ sandbox/adsk/trunk/Common/Stylization/StylizationEngine.cpp	2023-07-27 01:36:54 UTC (rev 10055)
@@ -776,6 +776,8 @@
         for (int i=0; i<nRules; ++i)
         {
             CompositeRule* r = static_cast<CompositeRule*>(rulecoll->GetAt(i));
+            rulecache[i].active = r->GetActive();
+
             const MdfString& filterstr = r->GetFilter();
             rulecache[i].filter = NULL;
             if (!filterstr.empty())
@@ -824,6 +826,9 @@
     if (rule == NULL)
         return;
 
+    if (!rule->active)
+        return;
+
     // we found a valid rule - send a StartFeature notification
     RS_String rs_tip, rs_url;
     if (seTip->expression || wcslen(seTip->getValue()) > 0)



More information about the mapguide-commits mailing list