1 Reply Latest reply on Sep 16, 2013 2:19 PM by Lqian-Oracle

    MapViewer not able to select a "too small for screen" feature




      I am using MapViewer version


      I encounter something strange at first but after digging it seems that there is a bug in the mapviewer.  I was using a very small linestring and was trying to programmatically select it (listing the features and it attributes of a layer then the user can highlight some of those) and the MapViewer was crashing saying that it cannot applyStyle() of null.


      What's happening is that the feature is within the screen bounds so it must be displayed (its displayed flag is set to true) but when the times come to transform its coordinates to screen coordinates those coordinates are too small thus not creating a "screen shape".  So the feature.shape stays null but the flag displayed remains to true therefore when trying to apply its selected style it crashes because there is no shape to apply it to.


      Here a few peace of code (oraclemapsv2.js) where I dug:


      In the displayFeature function of an OM.Feature class there is a switch where you draw all the shapes.


      When drawing a line string


                              case "LineString":

                                  this.drawLineString(z, C, q, l);  //The drawLineString is returning null but the value isn't used so the this.displayed flag is still set to true later on even if no shape were created.




      What's preventing the shape to be created is this part in the OM.util.ScreenTransform.prototype.transformSegment:


              if (Math.abs(s - e) > t || Math.abs(q - d) > l) {

                  e = s;

                  d = q;

                  s = Math.round(s * this.sx + this.tx);

                  q = Math.round(q * this.sy + this.ty);

                  u.push(s, q);



          if (u.length <= 2) {

              return null;

      it is used in the drawLineString function


      drawLineString: function (d, l, g, e) {

              if (!this.screenPoints) {

                  var n = g.coordinates.slice(0);

                  n = this.screenTransformObj.transformSegment(n, 2, g.dim);

                  if (n == null) {

                      return null;



      I hope this is clear enough.  From my point of view the return value of any drawXXXX functions should be used to set the displayed flag to a proper value, but you guys have a better understanding of all this so, tell me what to do on my side to fix the problem until it is fixed in a future release.  Oh and btw when I zoom close enough the feature shape is created and everything works fine.