Thursday, November 12, 2009

(II) New SDO_GEOMETRY <-> Autodesk Map3d 2010

Author: Jonio, Dennis

The DrawAbleType enums were easy. I just had to give them values that could be distinguised via “OR”ing them together.

  • Point = 1,
  • Line = 2,
  • Surface = 4


    Source code (C#):

    public static int InferGeometryType(List _drawables)
    {
    int rtnval = 0;
    if (_drawables.Count == 1)
    {
    switch (_drawables[0].DrawEtype)
    {
    case DrawAbleType.Point:
    rtnval = 1;
    break;
    case DrawAbleType.Line:
    rtnval = 2;
    break;
    case DrawAbleType.Surface:
    rtnval = 3;
    break;
    }
    }
    else
    {
    int ttype = 0;
    foreach (DrawAble d in _drawables)
    ttype = ttype | (int)d.DrawEtype;

    switch (ttype)
    {
    case 1:
    rtnval = 5; //MultiPoint
    break;
    case 2:
    rtnval = 6; //MultiLine
    break;
    case 4:
    rtnval = 7; //MultiPolygon
    break;
    default:
    rtnval = 4; //Collection
    break;
    }
    }
    return rtnval;
    }

    I really wrestled with these DrawAbleSubComponentEType enums. I tried to be really clever with these values and somehow take advantage of the relationship between ETYPE and INTERPRETATION. Tried is the operative word.

  • Point = 1, //1
  • PointCluster = 10, //1 + n
  • PointOriented = 19, //Not supported OrientedPoint
  • SimpleLine = 3, //2 + 1
  • SimpleLineAllCurves = 4, //2 + 2
  • CompoundLine = 40, //4 + n
  • SimpleSurfaceOuterRingLine = 1004, //1003 + 1
  • SimpleSurfaceOuterRingAllCurves = 1005, //1003 + 2
  • SimpleSurfaceOuterRingRectangle = 1006, //1003 + 3
  • SimpleSurfaceOuterRingCircle = 1007, //1003 + 4
  • SimpleSurfaceInnerRingLine = 2004, //2003 + 1
  • SimpleSurfaceInnerRingAllCurves = 2005, //2003 + 2
  • SimpleSurfaceInnerRingRectangle = 2006, //2003 + 3
  • SimpleSurfaceInnerRingCircle = 2007, //2003 + 4
  • CompoundSurfaceOuterRingLine = 10050, //1005 + n
  • CompoundSurfaceInnerRingLine = 20050 //2005 + n
    The specification has to many exceptions for this to work but at least I have my unique values.


    I do wonder alot as to why Oracle set up the unique combinations for Circle, Rectangle and instances of all Curves. I did read the spec on “Oriented Point” and just arbitrarily decided NOT to support it. I will never use it and I guess I am the boss. So if you need that you will have to do it yourself. It should be a straight forward job for someone with the motivation.


    When it gets time to resolve these into the “real” ETYPE and INTERPRETATION values I just set up a couple static methods in a static utility class.
    Source code (C#):

    public static int BasicETYPE(DrawAbleSubComponentEType t)
    {
    int rtnval = 0;
    switch (t)
    {
    case DrawAbleSubComponentEType.Point:
    case DrawAbleSubComponentEType.PointCluster:
    case DrawAbleSubComponentEType.PointOriented:
    rtnval = 1;
    break;
    case DrawAbleSubComponentEType.SimpleLine:
    case DrawAbleSubComponentEType.SimpleLineAllCurves:
    rtnval = 2;
    break;
    case DrawAbleSubComponentEType.CompoundLine:
    rtnval = 4;
    break;
    case DrawAbleSubComponentEType.SimpleSurfaceOuterRingLine:
    case DrawAbleSubComponentEType.SimpleSurfaceOuterRingAllCurves:
    case DrawAbleSubComponentEType.SimpleSurfaceOuterRingCircle:
    case DrawAbleSubComponentEType.SimpleSurfaceOuterRingRectangle:
    rtnval = 1003;
    break;
    case DrawAbleSubComponentEType.SimpleSurfaceInnerRingLine:
    case DrawAbleSubComponentEType.SimpleSurfaceInnerRingAllCurves:
    case DrawAbleSubComponentEType.SimpleSurfaceInnerRingCircle:
    case DrawAbleSubComponentEType.SimpleSurfaceInnerRingRectangle:
    rtnval = 2003;
    break;
    case DrawAbleSubComponentEType.CompoundSurfaceOuterRingLine:
    rtnval = 1005;
    break;
    case DrawAbleSubComponentEType.CompoundSurfaceInnerRingLine:
    rtnval = 2005;
    break;
    default:
    break;
    }
    return rtnval;
    }
    public static int BasicINTERPRETATION(DrawAbleSubComponentEType t)
    {
    int rtnval = 0;
    switch (t)
    {
    case DrawAbleSubComponentEType.Point:
    case DrawAbleSubComponentEType.SimpleLine:
    case DrawAbleSubComponentEType.SimpleSurfaceInnerRingLine:
    case DrawAbleSubComponentEType.SimpleSurfaceOuterRingLine:
    rtnval = 1;
    break;
    case DrawAbleSubComponentEType.SimpleSurfaceInnerRingAllCurves:
    case DrawAbleSubComponentEType.SimpleSurfaceOuterRingAllCurves:
    case DrawAbleSubComponentEType.SimpleLineAllCurves:
    rtnval = 2;
    break;
    case DrawAbleSubComponentEType.SimpleSurfaceOuterRingRectangle:
    case DrawAbleSubComponentEType.SimpleSurfaceInnerRingRectangle:
    rtnval = 3;
    break;
    case DrawAbleSubComponentEType.SimpleSurfaceInnerRingCircle:
    case DrawAbleSubComponentEType.SimpleSurfaceOuterRingCircle:
    rtnval = 4;
    break;
    case DrawAbleSubComponentEType.PointCluster:
    case DrawAbleSubComponentEType.CompoundLine:
    case DrawAbleSubComponentEType.CompoundSurfaceOuterRingLine:
    case DrawAbleSubComponentEType.CompoundSurfaceInnerRingLine:
    rtnval = 0;
    break;
    case DrawAbleSubComponentEType.PointOriented:
    rtnval = 9;
    break;
    default:
    break;
    }
    return rtnval;
    }

    To be continued ...
  • No comments:

    Post a Comment