Example - Using Point Rules
 
 

To create point-based rules, three methods are used.

    // ...

    //---------------------------------------------------//

    $factory = new LayerDefinitionFactory();

    // Create a mark symbol

    $resourceId = 'Library://Samples/Sheboygan/Symbols/BasicSymbols.SymbolLibrary';

    $symbolName = 'PushPin';

    $width = '24';

// points

    $height = '24';

// points

    $color = 'FFFF0000';

    $markSymbol = $factory->CreateMarkSymbol($resourceId, $symbolName, $width, $height, $color);

   

    // Create a text symbol

    $text = "ID";

    $fontHeight="12";

    $foregroundColor = 'FF000000';

    $textSymbol = $factory->CreateTextSymbol($text,

      $fontHeight, $foregroundColor);

    // Create a point rule.

    $legendLabel = 'trees';

    $filter = '';

    $pointRule = $factory->CreatePointRule($legendLabel,

      $filter, $textSymbol, $markSymbol);

     

    // Create a point type style.

    $pointTypeStyle = $factory->

      CreatepointTypeStyle($pointRule);

     

    // Create a scale range.

    $minScale = '0';

    $maxScale = '1000000000000';

    $pointScaleRange = $factory->CreateScaleRange($minScale,

      $maxScale, $pointTypeStyle);

    // Create the layer definiton.

    $featureClass = 'Library://Tests/Trees.FeatureSource';

    $featureName = 'Default:Trees';

    $geometry = 'Geometry';

    $layerDefinition = $factory->

      CreateLayerDefinition($featureClass, $featureName,

      $geometry, $pointScaleRange);

    //---------------------------------------------------//

    // ...