1 Reply Latest reply: Jul 23, 2013 10:13 AM by jsharma RSS

    Layer rendering Style

    DannyC.

      I am using the HTML5 MapViewer with mapbuilder tool for styling.

       

      When I want to add a new Feature to a vector layer, I sure wish to render it with the layer styling but the layer.getRenderingStyle is always empty/null/undefined.  Why?  Is there another way to get the current style for a layer?

       

      Another question is about the MapBuilder.  I would like to add a styling rule based on the geometry type  geom.sdo_gtype, I added the column in the styling rule but I cannot find documentation on what should be in the Query Condition box.

       

      Thanks in advance.

        • 1. Re: Layer rendering Style
          jsharma

          If the layer is a predefined layer (i.e. OM.layer.VectorLayer.TYPE_PREDEFINED) then the (server-side) style is picked up from the database.

          getRenderingLayer() in this case currently returns a null (this is likely a bug).

           

          However, since you're adding new features you probably want to use type_local and a client side defined style that was set using setRenderingStyle.

          With a predefined layer you need to know exactly what the Feature attributes are in order to add one in client code. Also that feature will not be in the database so the two with be out of sync. It won't be written to the database either. Would be simpler to update the database and refresh the layer.

           

          To use a server-side style (e.g. you want to use the style M.TRIANGLE) you first set it using getServerSideStyle(), i.e.

          OM.style.StyleStore.getServerSideStyle("mvdemo", "M.TRIANGLE",

          {url:baseURL, callback:function(serverSideStyle){vectorlayer.setRenderingStyle(serverSideStyle);}});

           

          Second, on using a styling_rule based on the geometry type you'd use a Collection bucket (or advanced style).

          The Table Alias value should be set (e.g. A for the table alias) and then use that alias value for the attribute column for the style e.g.

          A.GEOMETRY.SDO_GTYPE for the Collection bucket style. So you should end up with a styling rule defined as something like

          <?xml version="1.0" standalone="yes"?>

          <styling_rules key_column="NAME" table_alias="A">

              <rule column="A.GEOMETRY.SDO_GTYPE">

                  <features asis="true" style="V.GEOM_COLLECTION_TEST"> </features>

            </rule>

          </styling_rules>

           

          where V.GEOM_COLLECTION_TEST is defined as

          <?xml version="1.0" ?>

          <AdvancedStyle>

              <CollectionStyle>

                <style name="C.T5_TRANSGREY" shape="polygon"/>

                <style name="L.S01_ROAD_INTERSTATE" shape="line"/>

                <style name="M.ALL_CITY_L1_8X8" shape="point"/>

            </CollectionStyle>

          </AdvancedStyle>