Ticket #323 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

Theme: Individual rule for Numeric property is disordered.

Reported by: jennyhe Owned by: madair
Priority: P2 Milestone: Future
Component: Widgets Version: 1.1.1
Severity: Major Keywords:
Cc: christine.bao@…, Chris.Claydon@… External ID: 1276835
state: New Browser: All
Operating System: All

Description

Report from Autodesk QA

Steps: 1. Open one flexible web layout with Polygon data. 2. Theme->Select FeatId?, Individual as Distribution rule -> Apply

Results: Please refer to the attached png file, the rule is disordered and not based on the FeatID value. If using one String property, it looks correct.

Expected results; The rule should refer to the value of FeatID.

Attachments

Theme_Individual_Rule_disordered.PNG Download (109.8 KB) - added by jennyhe 4 years ago.
SortTheme.patch Download (2.0 KB) - added by christinebao 4 years ago.

Change History

Changed 4 years ago by jennyhe

Changed 4 years ago by christinebao

Tech diagnosis:
The code for getting new area rule is:

        $aggregateOptions = new MgFeatureAggregateOptions();

        $portion = 0.0;
        $increment = ($this->args['NUMRULES'] > 1) ? $increment = 1.0 / ($this->args['NUMRULES'] - 1) : 1.0;

        if ($this->args['DISTRO'] == 'INDIV_DIST')
        {
            $aggregateOptions->AddFeatureProperty($this->args['PROPERTYNAME']);
            $aggregateOptions->SelectDistinct(true);

            $dataReader = $featureService->SelectAggregate($resId, $layer->GetFeatureClassName(), $aggregateOptions);            
            while ($dataReader->ReadNext())
            {
                $value = $this->GetFeaturePropertyValue($dataReader, $this->args['PROPERTYNAME']);

                $filterText = '"' . $this->args['PROPERTYNAME'] . '" = ';
                if ($this->args['DATATYPE'] == MgPropertyType::String)
                    $filterText .= "'" . $value . "'";
                else
                    $filterText .= $value;

                $areaRuleXML = sprintf($areaRuleTemplate,
                    $this->args['PROPERTYNAME'] . ': ' . $value,
                    $filterText,
                    $this->InterpolateColor($portion, $this->args['FILLFROM'], $this->args['FILLTO'], $this->args['FILLTRANS']),
                    $this->InterpolateColor($portion, $this->args['LINEFROM'], $this->args['LINETO'], 0));

                $areaDoc = DOMDocument::loadXML($areaRuleXML);
                $areaNode = $doc->importNode($areaDoc->documentElement, true);
                if($hasChild)
                {
                  $areaTypeStyle->insertBefore($areaNode, $element);
                }
                else
                {
                  $areaTypeStyle->appendChild($areaNode);
                }

                $portion += $increment;
            }
            $dataReader->Close();
        }

It's not order by the property, thus the data are not ordered ascending or descending.

QA report if choose string property, the legend is not disordered. This is not true but a case of the data.

Although featureService has an option to set ordering filter (code as below), it's not supported by all providers, for example it's not supported by SDF. Thus it can't fully solve this problem.

            $orderByProperties = new MgStringCollection();
            $orderByProperties->Add($this->args['PROPERTYNAME']);
            $aggregateOptions->SetOrderingFilter($orderByProperties, MgOrderingOption::Ascending);

Changed 4 years ago by christinebao

Because not all providers support order by, another solution is to order the list in memory.

Changed 4 years ago by christinebao

Changed 4 years ago by christinebao

To support all providers and make code simple, the second solution (sort in memory) is chosen. Please review the attached patch http://trac.osgeo.org/fusion/attachment/ticket/323/SortTheme.patch.

Changed 4 years ago by christinebao

  • cc Chris.Claydon@… added

Hi Chris, would you please review this patch? Thank you!

Changed 4 years ago by christinebao

  • status changed from new to closed
  • resolution set to fixed

Test the patch and it works.

The patch is committed to catch up the build. If there is any comment, please feel free to contact me. Thank you.

Changed 4 years ago by chrisclaydon

The patch looks good.

Note: See TracTickets for help on using tickets.