Polygons with float precision?

Is it possible to use polygons with arrays of floats? I've looked up the source code and it seems that the code is all based around the use of ints.
How would I go about making a polygon use floats so that it can move smoothly around the screen? I've got it moving using ints, but this causes horrible jerky-like movement.
Thanks
Ribot.

g2d.drawOval(circleX, 400, 25, 25);
circleX++;That should move it by 1 pixel on the x axis each time through the loop, unless you have other code that is changing the value (perhaps you could add System.out.println("CircleX = " + circleX) statements before your drawOval statement...
in the same animation loop I feature the following
code which moves the graphics2D object by fractional
amounts across the screen (this is the effect I want
to get with a polygon based shape):It only moves on screen when the value of the integer part of the fraction changes (your monitor would be unable to move it by a fraction of a pixel). Why not use double values and cast them to ints if you want to replicate this?
>
circle.setFrame(550.5+(tickerTest*0.1), 300.5, 50,
60);
Area test = new Area(circle);
g2d.setColor(Color.magenta);
g2d.fill(test);
tickerTest++;
Is there a Graphics2D polygon type object? I've
looked in the API and haven't found anything. how about g2d.drawPolygon()
I have done this without double buffering and it works perfectly... a 20ms delay and there isn't any flicker (P3 600MHz, JDK 1.2.2), so I really don't understand unless you have some massive processing running concurrently... javax.swing.JFrame frame = new javax.swing.JFrame();
frame.setSize(200,200);
frame.show();
java.awt.Graphics2D g2d = (java.awt.Graphics2D)frame.getGraphics();
int x = 50;
int y = 50;
int dx = 1;
int dy = 2;
int width = 20;
int height = 20;
for(int i = 0; i < 1000; i++) {
     g2d.clearRect(0, 0, 200, 200);
     g2d.drawOval(x, y, width, height);
     x += dx;
     y += dy;
     if(x < 0 || x > 180) dx *= -1;
     if(y < 20 || y > 180) dy *= -1;
     Thread.sleep(20);

Similar Messages

  • Precision with float and double values

    Hi, does anyone knows how can i get more precise calculations with floating point numbers? Let's see an example:
    public class Teste {
    public static void main(String args[]) {
    float i = 0;
    while (i<=10) {
    System.out.println(i);
    i=i+0.1f;
    /* output
    0.0
    0.1
    0.2
    0.3
    0.4
    0.5
    0.6
    0.70000005
    0.8000001
    0.9000001
    1.0000001
    1.1000001
    1.2000002
    1.3000002
    1.4000002
    1.5000002
    1.6000003
    1.7000003
    1.8000003
    1.9000003
    2.0000002
    2.1000001
    2.2
    2.3
    2.3999999
    2.4999998
    2.5999997
    2.6999996
    2.7999995
    2.8999994
    2.9999993
    3.0999992
    3.199999
    3.299999
    3.399999
    3.4999988
    3.5999987
    3.6999986
    3.7999985
    3.8999984
    3.9999983
    4.0999985
    4.1999984
    4.2999983
    4.399998
    4.499998
    4.599998
    4.699998
    4.799998
    4.8999977
    4.9999976
    5.0999975
    5.1999974
    5.2999973
    5.399997
    5.499997
    5.599997
    5.699997
    5.799997
    5.8999968
    5.9999967
    6.0999966
    6.1999965
    6.2999964
    6.3999963
    6.499996
    6.599996
    6.699996
    6.799996
    6.899996
    6.9999957
    7.0999956
    7.1999955
    7.2999954
    7.3999953
    7.499995
    7.599995
    7.699995
    7.799995
    7.899995
    7.9999948
    8.099995
    8.199995
    8.299995
    8.399996
    8.499996
    8.599997
    8.699997
    8.799997
    8.899998
    8.999998
    9.099998
    9.199999
    9.299999
    9.4
    9.5
    9.6
    9.700001
    9.800001
    9.900002
    */

    http://forum.java.sun.com/thread.jsp?forum=31&thread=357174

  • Draw fct with float

    Does someone know why all draw fonction like drawArc, drawLine use int instead of float or double? it would not be more precise to draw with float or double?
    thx

    fonction? LOL!
    Seriously though, the method you want is java.awt.Graphics2D.draw(Shape) and fill(Shape). You would use it like this:
    protected void paintComponent(Graphics g) {
      Graphics2D g2 = (Graphics2D) g;  // cast required to get Graphics2D functionality
      // Now make a shape, any shape
      Shape shape = new Rectangle2D.Double(2.5, 3.0, 30.0, 40.0);
      g2.setColor(Color.yellow);
      g2.fill(shape);
      g2.setColor(Color.black);
      g2.draw(shape);
    }Hope this helps.

  • TLF 2/2.1/3 Weird behavior with floating graphics?

    Hi guys,
    I'm working on a chat application running on RED5 / AS3 and I'm struggling to get my client "UI" working perfectly.
    My problem is related to the TL Framework, on every version available.
    Basicly, I want to display a picture ( for user messages ) and icons ( for notifications ) on the left side of my lines, like this :
    So, I'v been messing around with "float=start", "float=left" and such, but i'm always encountering weird behaviors whenever I scroll or resize my containerController. It's quite easy to reproduce with the following code :
    public class Main extends Sprite
              private var controller:ContainerController;
              public function Main():void
                        if (stage) init();
                        else addEventListener(Event.ADDED_TO_STAGE, init);
              private function init(e:Event = null):void
                        stage.scaleMode = StageScaleMode.NO_SCALE;
                        stage.align = StageAlign.TOP_LEFT;
                        removeEventListener(Event.ADDED_TO_STAGE, init);
                        var holder:Sprite = new Sprite();
                        addChild( holder );
                        var tFlow:TextFlow = new TextFlow();
                        for ( var i:int = 0; i < 50; i++ )
                             tFlow.addChild( createLine() );
                        controller = new ContainerController( holder, 400, stage.stageHeight  );
                        tFlow.flowComposer.addController( controller );
                        tFlow.flowComposer.updateAllControllers();
                        stage.addEventListener( Event.RESIZE, resizeController );
              private function resizeController( e:Event ):void
                        controller.setCompositionSize( 400, stage.stageHeight );
                        controller.textFlow.flowComposer.updateAllControllers();
              public function createLine( ):DivElement
                        var d:DivElement;
                        var p:ParagraphElement;
                        var im:InlineGraphicElement = new InlineGraphicElement();
                        im.source = new Bitmap( new BitmapData( 16, 16, true, 0x30FF0000 ) ); // 0x30 Alpha
                        im.float = "left";
                        d = new DivElement();
                        d.clearFloats = "both";
                        p = new ParagraphElement();
                        d.addChild( p );
                        p.addChild( im );
                        return d;
    Basicly, I'm stacking 50 transparent "floating" elements. It works fine most of time, but if I randomly resize my Flash Player Window, I can get the first "invisible" element to overlap the last "visible" :
    It seems to be happening right when the last "floating" element should disappear. Instead, it gets "over" the previous one. It happens upon container resize and scrolls. I'v encountered this issue on lastest 2, 2.1 and 3 TLF builds.
    Beside the visual "bug", it also screws up my container.getContentBounds().height calls - which can make scrolling "trembling", as the height gets reajusted.
    I'm running out of ideas about how to handle this. This bug appears whenever I use "floating" graphics and I can't think of any other way to display graphics on the left side of my chat-lines.
    Maybe someone ran into this very problem and figured out a way to make it work?
    Excuse my english, thanks in advance,
    Lionel.

    Thank you for your report. And I have found the root cause.
    In BaseCompose.as
    protected function composeFloat(elem:InlineGraphicElement, afterLine:Boolean):Boolean
    if (!floatFits && (_curParcel.fitAny || _curParcel.fitsInHeight(totalDepth, int(logicalFloatHeight))) && (!_curLine || _curLine.absoluteStart == floatPosition || afterLine))
                    floatFits = true;
    The condition of if is true, only when the weird behavior happens. We need to discuss about how to fix it.

  • Problem with SDO_relate when using polygons with holes.

    I'm having a problem with sdo_relate. I'm trying to extract all elements from a point table (bdtq_batim_p) that are inside a specific polygon from another table (SDA_MUNIC_SS). The spatial index for both table have been rebuilt and the data from both table is valid.
    When I do a count on the query, I know the answer should be 1422 elements (Counted in ArcGIS). However, sdo_relate gives a smaller number of elements in the result set.
    The query :
    SELECT count(distinct t.identifiant) FROM bdtq_batim_p t, SDA_MUNIC_SS s WHERE s.mus_co_geo = '48015' and sdo_relate( t.SHAPE,s.SHAPE,'mask=anyinteract querytype=window') = 'TRUE'
    returns 282 elements. The query with mask=inside, SDO_Anyinteract() and SDO_inside() all give the same result.
    I did a test with the following query and the result is 1422 (which is the good result).
    SELECT count(distinct t.identifiant) FROM bdtq_batim_p t, SDA_MUNIC_SS s WHERE s.mus_co_geo = '48015' and SDO_WITHIN_DISTANCE( t.SHAPE,s.SHAPE,'distance=0') = 'TRUE';
    It's important to note that the polygone (from SDA_MUNIC_SS) that is used for this query have holes in it. I have the same problem with all the polygons from the SDA_MUNIC_SS table that have holes in it. For the polygon without holes, the results are the same for the 2 queries.
    My question are :
    Why are the result from the two queries different? A query with a buffer of 0 should always return the same result as a query with Anyinteract.
    Is there a known problem with SDO_RELATE when using a polygon with holes in it?
    Do you have any idea how to solve my problem.

    Since i don't have much control on the version of Oracle and Patches that we use in the system, we used a workaround that detects the polygons with holes and uses the SDO_WITHIN_DISTANCE( t.SHAPE,s.SHAPE,'distance=0') = 'TRUE' operator in those case. We saw a slight decline in performance but it now returns the right results. When the system will be patched, we'll come back to the original version and see if the problem is solved.

  • Sdo_util.polygontoline on polygon with hole - multi line?

    If I run sdo_util.polygontoline on a polygon with hole I would expect it to return a multi line with gtype=2006.
    Is that right?
    It doesn't in this case:
    jot_test@johnot> SELECT * FROM v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    5 rows selected.
    jot_test@johnot>
    jot_test@johnot> CREATE TABLE polygon_test (
      2  what varchar2(100),
      3  geometry sdo_geometry);
    Table created.
    jot_test@johnot>
    jot_test@johnot> INSERT INTO polygon_test (what, geometry) VALUES ('polygon with 3 holes',
      2  MDSYS.SDO_GEOMETRY(2003, 2157, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,41,2003,1,51,2003,1,61,2003,1), MDSYS.SDO_ORDINATE_ARRAY(644507.868,753517.124,
      3  644631.7897, 753533.6922, 644611.409, 753534.591, 644610.6025, 753545.5654, 644533.3319, 753588.8677, 644508.545, 753574.04, 644489.2124, 753613.5921,
      4  644454.5051, 753632.781, 644448.097, 753629.818, 644443.393, 753638.8542, 644410.0624, 753657.0707, 644396.379, 753651.217, 644392.824, 753655.998,
      5  644403.559, 753660.6251, 644390.1554, 753667.9506, 644385.891, 753666.108, 644363.783, 753682.497, 644430.984, 753599.479, 644490.526, 753515.738,
      6  644507.868, 753517.124, 644422.11, 753642.465, 644407.545, 753636.233, 644403.653, 753641.432, 644422.426, 753649.114, 644422.11, 753642.465,
      7  644417.5533, 753621.438, 644432.735, 753628.312, 644435.627, 753622.475, 644420.7838, 753615.5539, 644417.5533, 753621.438, 644453.003, 753576.579,
      8  644436.343, 753599.448, 644471.478, 753620.606, 644518.412, 753525.872, 644493.611, 753520.131, 644453.003, 753576.579)));
    1 row created.
    jot_test@johnot>
    jot_test@johnot> SELECT sdo_geom.validate_geometry_with_context(geometry, 0.0005) FROM polygon_test;
    SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(GEOMETRY,0.0005)
    TRUE
    1 row selected.
    jot_test@johnot>
    jot_test@johnot> SELECT sdo_util.polygontoline(geometry) FROM polygon_test;
    SDO_UTIL.POLYGONTOLINE(GEOMETRY)(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    SDO_GEOMETRY(2002, 2157, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1, 41, 2, 1, 51, 2, 1, 61, 2, 1), SDO_ORDINATE_ARRAY(644507.868, 753517.124, 644631.79, 753533.692,
    644611.409, 753534.591, 644610.603, 753545.565, 644533.332, 753588.868, 644508.545, 753574.04, 644489.212, 753613.592, 644454.505, 753632.781, 644448.097, 753629.818,
    644443.393, 753638.854, 644410.062, 753657.071, 644396.379, 753651.217, 644392.824, 753655.998, 644403.559, 753660.625, 644390.155, 753667.951, 644385.891, 753666.108,
    644363.783, 753682.497, 644430.984, 753599.479, 644490.526, 753515.738, 644507.868, 753517.124, 644422.11, 753642.465, 644407.545, 753636.233, 644403.653, 753641.432,
    644422.426, 753649.114, 644422.11, 753642.465, 644417.553, 753621.438, 644432.735, 753628.312, 644435.627, 753622.475, 644420.784, 753615.554, 644417.553, 753621.438,
    644453.003, 753576.579, 644436.343, 753599.448, 644471.478, 753620.606, 644518.412, 753525.872, 644493.611, 753520.131, 644453.003, 753576.579))
    1 row selected.I was expecting that to return gtype=2006 and I think that's causing me some problems which I now need to investigate further.
    If someone can confirm that it should be returning gtype=2006 then I'll get open a tar on metalink.
    Thanks,
    John

    sdo_aggr_union seems to know to make it a multiline...
    jot_test@johnot> SELECT sdo_aggr_union(sdoaggrtype(sdo_util.polygontoline(geometry),0.0005)) FROM polygon_test;
    SDO_AGGR_UNION(SDOAGGRTYPE(SDO_UTIL.POLYGONTOLINE(GEOMETRY),0.0005))(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    SDO_GEOMETRY(2006, 2157, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1, 41, 2, 1, 53, 2, 1, 63, 2, 1), SDO_ORDINATE_ARRAY(644631.79, 753533.692, 644507.868, 753517.124,
    644490.526,753515.738, 644430.984, 753599.479, 644363.783, 753682.497, 644385.891, 753666.108, 644390.155, 753667.951, 644403.559, 753660.625, 644392.824, 753655.998,
    644396.379, 753651.217, 644410.062, 753657.071, 644443.393, 753638.854, 644448.097, 753629.818, 644454.505, 753632.781, 644489.212, 753613.592, 644508.545, 753574.04,
    644533.332, 753588.868, 644610.603, 753545.565, 644611.409, 753534.591, 644631.79, 753533.692, 644518.412, 753525.872, 644471.478, 753620.606, 644436.343, 753599.448,
    644453.003, 753576.579, 644493.611, 753520.131, 644518.412, 753525.872, 644435.627, 753622.475, 644420.784, 753615.554, 644417.553, 753621.438, 644432.735, 753628.312,
    644435.627, 753622.475, 644422.426, 753649.114, 644403.653, 753641.432, 644407.545, 753636.233, 644422.11, 753642.465, 644422.426, 753649.114))

  • Running SDO_INTERSECTION with a Polygon with a hole

    Hello,
    I'm running into some issues when using SDO_INTERSECTION between two spatial tables. In my parcel table, I have polygons that will have a hole in them. When using SDO_INTERSECTION between the parcels and our land use layer to get area figures, I run into the Oracle error, "Unable to construct spatial object". I tracked it down to those parcels with holes that are causing the problem.
    Does anyone know how to avoid this problem or make SDO_INTERSECTION work for those polygons with holes? Thanks in advance.
    Juan Butler
    [email protected]

    I've looked at this some more and I don't think it's so much an issue with polygons with holes, but something with the way these two polygons are interacting.
    Here is the query that I'm using to test the validity of the resulting intersection.
    SELECT sdo_geom.validate_geometry_with_context(sdo_geom.sdo_intersection(b.GEOMETRY, a.geometry, .01),.01)
    FROM SP_PARCELBASE a, SP_FUTURE_LANDUSE b
    WHERE sdo_relate(b.geometry,a.geometry,'mask=ANYINTERACT') = 'TRUE'
    AND a.gid = 53887816
    Here are the geometries of the problem polygons...
    - FROM SP_PARCELBASE
    (2003, 82000, , (1, 1003, 1, 75, 2003, 1, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ), (252134.399999992, 1300154.70000085, 252218.899999986, 1299775.00000085, 252223.899999986, 1299769.00000084, 252382.099999989, 1299577.70000084, 252397.499999992, 1299571.20000085, 252473.599999991, 1299538.90000084, 252537.699999992, 1299511.80000084, 252626.999999992, 1299426.10000084, 252749.299999991, 1299308.70000085, 252751.799999986, 1299306.20000085, 252799.599999992, 1299230.90000084, 252885.699999993, 1299212.80000084, 252951.699999992, 1299159.70000084, 253031.69999999, 1299158.20000085, 253033.299999991, 1299317.70000084, 253033.299999991, 1299320.80000085, 253034.399999993, 1299427.20000084, 253036.49999999, 1299606.20000085, 253036.499999987, 1299608.20000084, 253243.49999999, 1299604.80000085, 253350.299999993, 1299602.90000085, 253375.299999991, 1299602.50000085, 253629.799999993, 1299598.00000085, 253630.19999999, 1299730.80000084, 253363.699999992, 1299735.60000084, 253366.299999994, 1300103.30000084, 253366.499999986, 1300127.70000085, 253553.699999991, 1300124.70000085, 253553.699999991, 1300128.60000085, 253553.699999992, 1300131.30000084, 253554.199999993, 1300233.50000084, 252393.899999991, 1300252.50000085, 252393.999999992, 1300267.70000085, 252394.199999993, 1300284.10000084, 252341.099999992, 1300225.90000084, 252288.599999986, 1300168.50000084, 252134.399999992, 1300154.70000085, 252987.099999988, 1299658.60000085, 252987.799999992, 1299766.80000085, 253193.49999999, 1299765.20000085, 253193.099999992, 1299716.30000085, 253195.699999988, 1299716.30000085, 253198.999999991, 1299715.60000085, 253201.699999991, 1299714.10000085, 253204.29999999, 1299712.10000085, 253205.999999992, 1299709.30000084, 253207.199999991, 1299706.30000085, 253207.599999993, 1299703.30000085, 253207.599999986, 1299699.70000084, 253207.499999992, 1299685.90000084))
    - FROM SP_FUTURE_LANDUSE
    (2003, 82000, , (1, 1003, 1, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ), (253631, 1300130, 253631.7, 1300247.4, 253554, 1300248.5, 253554.2, 1300233.5, 252393.9, 1300252.5, 252391.7, 1300150, 252134.4, 1300154.7, 252218.9, 1299775, 252223.9, 1299769, 252228.4, 1299778.4, 252266.6, 1299791.9, 252273.6, 1299778.6, 252290.4, 1299768.6, 252306.4, 1299759, 252328.9, 1299736.1, 252359.8, 1299699.7, 252366.8, 1299706.3, 252367.9, 1299694.5, 252364.9, 1299688.1, 252374.7, 1299665.7, 252393.6, 1299638.8, 252402, 1299626.8, 252453.5, 1299621.3, 252476.1, 1299606.3, 252535.9, 1299596.2, 252558.5, 1299620.8, 252598.5, 1299624.4, 252654.3, 1299626.3, 252701.3, 1299630.2, 252717.7, 1299632.2, 252723.6, 1299641.1, 252733.1, 1299642.3, 252749.6, 1299652.9, 252755, 1299644, 252760.9, 1299631.9, 252775.4, 1299638.8, 252790.4, 1299636.3, 252805.9, 1299613.6, 252813.7, 1299566.8, 252815.9, 1299554, 252817.2, 1299515.8, 252726.2, 1299501, 252707.1, 1299503.5, 252680.4, 1299504.1, 252656.6, 1299510.6, 252612.3, 1299513.9, 252565.3, 1299516.7, 252541.4, 1299521.2, 252509.6, 1299540.1, 252479.8, 1299542.1))

  • Smart Forms : problem with Float Variable

    Hi  Expert,
       I have a probelm with Float variable. In my smart forms one fields of table QAMV contain value like 8.0000000000000000E+01.
    I have to remove the exponent and display value like 80.
    I have tried wa_qamv-sollwert(E10.4).. but it not working.
    Can U suggest me some solution.
    Regards
    Swati.
    Edited by: Swati Namdev on Apr 27, 2010 12:19 PM

    Hi,
    Please follow the steps.
    1. In your smart form create a variable w_val ,, type,, associate type -->  CHAR10
    2. Now write a code, jsut above your node where u wud like to get this value... For this Create -> Flow Logic -> Program Lines.. Now you have editor..
    3. In input parameters , put i_tab-QAMV.. and in output parameter put w_val... and Code like below
    CALL FUNCTION 'MD_CONV_QUANTITY_FLOAT_TO_PACK'
      EXPORTING
        iv_menge       = i_tab-qamv
      IMPORTING
        EV_MENGE       = w_val.
    4. Now grag and drop this w_val from global data field list...your this w_val will have the rounded value.. Pls try this and check..   It will work.
    Regards,
    Lokesh.
    Edited by: Lokesh Tarey on Apr 27, 2010 9:28 AM

  • Draw line with float values possible

    Hi,
    Using Canvas drawing is possible to draw line with float values.
    graphics.drawLine(int,int,int,int);
    graphics.drawLine(float,float,float,float);Thanks and regards,
    Rakesh.

    not possible
    graphics.drawLine(float,float,float,float);...there's no such method in MIDP API: [click here for javadoc of Graphics class methods|http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Graphics.html#drawLine(int,%20int,%20int,%20int)]

  • Polygon with a hole

    Hi all,
    I Have got a polygon with a hole, How can I have  Exterior rings vertices only?
    This is a shape example
    MDSYS.SDO_GEOMETRY(3003,null,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,16,2003,1),MDSYS.SDO_ORDINATE_ARRAY(575876.863338807,5000843.2303514,0,575875.717173073,5000826.03786538,0,575893.511998443,5000824.19470697,0,575894.261480691,5000843.33533055,0,575876.863338807,5000843.2303514,0,575881.116715103,5000837.33947256,0,575886.290860426,5000837.06483032,0,575886.092402506,5000829.67988328,0,575880.8284527,5000830.19056495,0,575881.116715103,5000837.33947256,0))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
    If I use this statement I get back all vertices                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
    SELECT c.id,  t.X, t.Y, t.id
       FROM LAND c,
       TABLE(SDO_UTIL.GETVERTICES(c.GEOMETRY2)) t
       WHERE c.ID = 3888
    I work on Oracle Database 10g
    Thanks in advance.
    Angelo

    Hi Angelo,
    Note this has been answered before on the forum
    How do I remove inner rings from a complex geometry of SDO_GEOMETRY type
    In terms of your code, you need a second parameter for the ring extraction.  The first ",1" grabs the first element (for a single part geometry its just the geometry) and the second ",1" grabs the first ring of that first element.  Note there are a lot of caveats to your simple extraction that the code in the post above may help with. 
    Paul
    SELECT c.id,  t.X, t.Y, t.id
      FROM LAND c,
      TABLE(SDO_UTIL.GETVERTICES(sdo_util.extract(c.GEOMETRY2,1,1))) t
      WHERE c.ID = 3888

  • Validate geometry can't check polygon with puncture?

    Hi,
    I have polygon with puncture as follow:
    POLYGON ((100.378750779898 -0.310282546668259, 100.378772459506 -0.310271543916926, 100.378838852504 -0.310235840196097, 100.378845732154 -0.310224416657996, 100.378844002915 -0.31020930373441, 100.37871739762 -0.309977750136478, 100.378616547328 -0.310045414011517, 100.378548060368 -0.309924611880424, 100.378750779898 -0.310282546668259))
    According to OGC simple feature it is invalid geometry because it has a puncture. ArcGIS SDE can't render this geoemetry. However, sdo_geometry.validate_geoemetry says it is a valid geometry. Why sdo doesn't consider this as an invalid geoemrty?

    Hi,
    It'd be useful if you provided a bit more information with your post:
    - your name (user3907494 ?)
    - the version of Oracle
    - the tolerance that you validated at
    Note that the geometry doesn't actually seem to be self intersecting - there seems to be an 8mm gap at the point where you might think it self intersects.
    I validated the geometry on 10.2.0.5 and 11.2.0.2 and got different results.
    Invalid on 10.2.0.5:
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE    10.2.0.5.0      Production
    TNS for 64-bit Windows: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
    5 rows selected.
    SQL> select sdo_geom.validate_geometry_with_context(
      2    sdo_geometry(2003, 8307, null, sdo_elem_info_array(1,1003,1),
      3    sdo_ordinate_array(
      4    100.378750779898, -0.310282546668259,
      5    100.378772459506, -0.310271543916926,
      6    100.378838852504, -0.310235840196097,
      7    100.378845732154, -0.310224416657996,
      8    100.378844002915, -0.31020930373441,
      9    100.37871739762, -0.309977750136478,
    10    100.378616547328, -0.310045414011517,
    11    100.378548060368, -0.309924611880424,
    12    100.378750779898, -0.310282546668259
    13    )), 0.00005) as result
    14  from dual;
    RESULT
    13349 [Element <1>] [Ring <1>][Edge <8>][Edge <6>]Valid on 11.2.0.2
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    5 rows selected.
    SQL> select sdo_geom.validate_geometry_with_context(
      2    sdo_geometry(2003, 8307, null, sdo_elem_info_array(1,1003,1),
      3    sdo_ordinate_array(
      4    100.378750779898, -0.310282546668259,
      5    100.378772459506, -0.310271543916926,
      6    100.378838852504, -0.310235840196097,
      7    100.378845732154, -0.310224416657996,
      8    100.378844002915, -0.31020930373441,
      9    100.37871739762, -0.309977750136478,
    10    100.378616547328, -0.310045414011517,
    11    100.378548060368, -0.309924611880424,
    12    100.378750779898, -0.310282546668259
    13    )), 0.00005) as result
    14  from dual;
    RESULT
    TRUEI'm not too sure why this happens. Maybe someone else can comment?
    Regards,
    John

  • JSlider with Floating point values

    I desperatly need to create a JSlider with floating/decimal values. For example between 0 and 1 and ticks within an interval of 0.1.
    The default behaviour of JSlider doesn't allow me to do so, hence is there any other way around ? I know it's possible to programmatically handle the required calculation by divding the values by 10, 100 or anything, but i want to display the actual values (floating/decimal) on the JSlider bar.
    Thanks in advance

    this might do you for the display
    import javax.swing.*;
    import java.awt.*;
    class JSliderLabels extends JFrame
      public JSliderLabels()
        setLocation(400,200);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        JSlider slider = new JSlider(0, 100, 1);
        slider.setMajorTickSpacing(25);
        slider.setPaintTicks(true);
        java.util.Hashtable labelTable = new java.util.Hashtable();
        labelTable.put(new Integer(100), new JLabel("1.0"));
        labelTable.put(new Integer(75), new JLabel("0.75"));
        labelTable.put(new Integer(50), new JLabel("0.50"));
        labelTable.put(new Integer(25), new JLabel("0.25"));
        labelTable.put(new Integer(0), new JLabel("0.0"));
        slider.setLabelTable( labelTable );
        slider.setPaintLabels(true);
        JPanel jp = new JPanel();
        jp.add(slider);
        getContentPane().add(jp);
        pack();
      public static void main(String[] args){new JSliderLabels().setVisible(true);}
    }

  • Extrude 3D polygons with multiple rings in Oracle spatial

    In this thread Extrude 3D polygons in Oracle spatial Baris provided a sample script to extrude a polygon with one ring into a 3D solid.
    How do I extrude a polygon with multiple rings?
    Given this polygon
    ! http://public.johnnyotoole.fastmail.fm/Polygon_with_hole.jpg !
    , I tried to create a solid as follows:
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0      Production
    TNS for 32-bit Windows: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    5 rows selected.
    SQL> DECLARE
      2    l_base_geom      SDO_GEOMETRY;
      3    l_solid  SDO_GEOMETRY;
      4   BEGIN
      5
      6    l_base_geom :=
      7     SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1, 21, 2003, 1),
      8     SDO_ORDINATE_ARRAY(568758.064, 835364.907, 568735.12, 835362.873, 568735.897, 835354.404, 568737.264, 835334.554,
      9     568738.711, 835317.612, 568758.063, 835319.294, 568790.598, 835322.124, 568787.473, 835358.924, 568786.671, 835367.888,
    10     568758.064, 835364.907, 568758.063, 835354.97, 568758.811, 835355.046, 568759.253, 835349.107, 568764.952, 835349.529,
    11     568764.51, 835355.468, 568778.388, 835356.625, 568778.627, 835353.883, 568778.681, 835353.252, 568778.757, 835352.388,
    12     568780.648, 835330.63, 568758.063, 835328.714, 568747.322, 835327.804, 568744.841, 835353.627, 568758.063, 835354.97));
    13
    14     DBMS_OUTPUT.PUT_LINE('Valid? ' || SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(l_base_geom, 0.005));
    15
    16     l_solid :=
    17     SDO_UTIL.EXTRUDE(
    18             l_base_geom,
    19             SDO_NUMBER_ARRAY(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
    20             SDO_NUMBER_ARRAY(5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5),
    21             'FALSE',
    22             0.005);
    23
    24  DBMS_OUTPUT.PUT_LINE('Volume: ' || sdo_geom.sdo_volume(l_solid,0.005));
    25
    26  END;
    27  /
    Valid? TRUE
    DECLARE
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.ArrayIndexOutOfBoundsException
    ORA-06512: at "MDSYS.SDO_UTIL", line 241
    ORA-06512: at line 16Any ideas?

    Would you please have only 10 elements in your sdo_number_arrays in your case?Is this what you mean?
    SQL> DECLARE
      2    l_base_geom      SDO_GEOMETRY;
      3    l_solid  SDO_GEOMETRY;
      4   BEGIN
      5
      6    l_base_geom :=
      7     SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1, 21, 2003, 1),
      8     SDO_ORDINATE_ARRAY(568758.064, 835364.907, 568735.12, 835362.873, 568735.897, 835354.404, 568737.264, 835334.554,
      9     568738.711, 835317.612, 568758.063, 835319.294, 568790.598, 835322.124, 568787.473, 835358.924, 568786.671, 835367.888,
    10     568758.064, 835364.907, 568758.063, 835354.97, 568758.811, 835355.046, 568759.253, 835349.107, 568764.952, 835349.529,
    11     568764.51, 835355.468, 568778.388, 835356.625, 568778.627, 835353.883, 568778.681, 835353.252, 568778.757, 835352.388,
    12     568780.648, 835330.63, 568758.063, 835328.714, 568747.322, 835327.804, 568744.841, 835353.627, 568758.063, 835354.97));
    13
    14     DBMS_OUTPUT.PUT_LINE('Valid? ' || SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(l_base_geom, 0.005));
    15
    16     l_solid :=
    17     SDO_UTIL.EXTRUDE(
    18             l_base_geom,
    19             SDO_NUMBER_ARRAY(0,0,0,0,0,0,0,0,0,0),
    20             SDO_NUMBER_ARRAY(5,5,5,5,5,5,5,5,5,5),
    21             'FALSE',
    22             0.005);
    23
    24  DBMS_OUTPUT.PUT_LINE('Volume: ' || sdo_geom.sdo_volume(l_solid,0.005));
    25
    26  END;
    27  /
    Valid? TRUE
    DECLARE
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.Exception: 54550
    ORA-06512: at "MDSYS.SDO_UTIL", line 241
    ORA-06512: at line 16
    If the heights and ground heights are all the same in your sdo_number_arrays (as in this case), then you can just specify one number in each array instead of specifying a height/ground height for each vertex.Ok, I see what you mean. This works when I use just the outer ring.
    SQL> DECLARE
      2    l_base_geom      SDO_GEOMETRY;
      3    l_solid  SDO_GEOMETRY;
      4   BEGIN
      5
      6    l_base_geom :=
      7     SDO_UTIL.EXTRACT(
      8     SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1, 21, 2003, 1),
      9        SDO_ORDINATE_ARRAY(568758.064, 835364.907, 568735.12, 835362.873, 568735.897, 835354.404, 568737.264, 835334.554,
    10        568738.711, 835317.612, 568758.063, 835319.294, 568790.598, 835322.124, 568787.473, 835358.924, 568786.671, 835367.888,
    11        568758.064, 835364.907, 568758.063, 835354.97, 568758.811, 835355.046, 568759.253, 835349.107, 568764.952, 835349.529,
    12        568764.51, 835355.468, 568778.388, 835356.625, 568778.627, 835353.883, 568778.681, 835353.252, 568778.757, 835352.388,
    13        568780.648, 835330.63, 568758.063, 835328.714, 568747.322, 835327.804, 568744.841, 835353.627, 568758.063, 835354.97)),
    14     1,1);
    15
    16     DBMS_OUTPUT.PUT_LINE('Valid? ' || SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(l_base_geom, 0.005));
    17
    18     l_solid :=
    19     SDO_UTIL.EXTRUDE(
    20             l_base_geom,
    21             SDO_NUMBER_ARRAY(0),
    22             SDO_NUMBER_ARRAY(5),
    23             'FALSE',
    24             0.005);
    25
    26  DBMS_OUTPUT.PUT_LINE('Volume: ' || sdo_geom.sdo_volume(l_solid,0.005));
    27
    28  END;
    29  /
    Valid? TRUE
    Volume: 11839.18887702For the purposes of what I'm doing now, I think I'll just use the outer ring to create my solids, but it would be useful if SDO_UTIL.EXTRUDE works on polygons with multiple rings (maybe it does, I'm probably doing something wrong...).

  • How i can calculate area of polygon with java ??

    hello
    i've trouble with calculation polygon-area
    is there any body who is good at calculation of shapes?
    i explain my problem with pictures.
    on piture2, i can calculate red-area of polygon with reference "http://www.cs.princeton.edu/introcs/33modular/Polygon.java.html"
    but, i can't do it on picture1.
    please help me and understand that i'm poor at english
    picture 1.
    http://myhome.naver.net/imsangchin/trace1.jpg
    picture 2.
    http://myhome.naver.net/imsangchin/trace2.jpg

    Do you have a formula that generates picture 1?
    If so, then you can use the basic formula for integration... take very very small steps and sum up all the steps, you can get as close as you like by making the steps sufficiently small.
    If you don't have a formula to generate the picture, then you can do it by essentially counting the number of colored pixels in the shape and calling them any type of appropriate units or actually scaling converting them to inches or cm or what ever you are using. You can do this by just scanning across the image and counting how many pixes are on each line, then go to the next line. Do this for the entire image only counting the target color and then do your conversion.

  • Timestamp with nanosecond precision

    Hi everyone,
    does exist in JAVA a wat (analog to System.currentMillis() ) to express timestamp with nanosecond precision??
    Thank you very much all.
    Diego

    My problem is for JAVA 1.4.... I know that in JAVA 1.5 method System.getNano() exists...

Maybe you are looking for

  • Should I create a new iTunes Library on my new iMac?

    I have been using a MacPro with multiple hard drives. One such 2TB drive has been the location of my MacPro iTunes library and media files. It takes up about 1.5TB of space with all the music, video and books. I use EyeTV from Elgato to record TV sho

  • How to add a second row in an IRR report header

    I have a report with 19 columns. Right now I have a bunch of columns that look like: 0-19 Males   | 0-19 Females  |   20-30 Males   |  20-30 Females 24                  22                      16                     17 I need it to look like: 0- 19  

  • Re-establish my icloud contacts in Outlook 2010 on Win8.1Pro

    I had icloud contacts in Outlook 2010 on Windows 8 and it worked fine. When I upgraded to Win 8.1 the other cloud features work but my icloud contacts tab in outlook 2010 contacts is now empty. When I click on it it says,"The set of folders could not

  • MovieClip Hide/Show on release

    I'm making a Flash AS2 Dress-up game and I want to show/Hide movie clips on release of a button like this one; http://charfade.deviantart.com/art/Dress-Up-Nala-Game-107105062 I am rather new to Flash and i was wondering if you knew any tutorial(s) th

  • My query prompts does not appear in the Query prompt order list!

    Dear colleagues, All of my query prompts does not appear in the Query prompt order list in properties of the query. It seems random which of them that appears there and not. This makes it impossible for me to control or change the order of prompts, i