Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#323 closed defect (fixed)

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@… Browser: All
External ID: 1276835 Operating System: All
state: New

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 (2)

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

Download all attachments as: .zip

Change History (8)

comment:1 by christinebao, 14 years ago

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);

comment:2 by christinebao, 14 years ago

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

by christinebao, 14 years ago

Attachment: SortTheme.patch added

comment:3 by christinebao, 14 years ago

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.

comment:4 by christinebao, 14 years ago

Cc: Chris.Claydon@… added

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

comment:5 by christinebao, 14 years ago

Resolution: fixed
Status: newclosed

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.

comment:6 by chrisclaydon, 14 years ago

The patch looks good.

Note: See TracTickets for help on using tickets.