Forcing Points to be in Polygon

Hi,
I have point soutside of boundaries(polygons) which may be caused by wrong geocoding.
I need to snap these points back to teh boundary so i can caluclate distance from teh boundaries centroid to teh point.
How can tolerance help me in this?

Hi all,
It is 10GR/2 and its 2D.
What I am trying to achive is ..some of the points( customers) went out of the country border due to incorrect geocoding and I need to snap it back to the whatever state which is teh nearest.If it is within two borders of state , I need to snap it to the nearest state like maybe building buffers around the point and when the buffer touches any state then i will snap it back to that state.( I think thsi is not teh right approach).
Teh polygons are fine, it is wrong geocoding, they just land in the oceans.

Similar Messages

  • Force pointer to a different audio file

    I often use the function to open a file in an external sample editor (usually izotope) while a Logic song is open. But the following applies even when not using this particular command. That particular command is handy in the sense that Logic keeps refreshing the updated file as it's being edited, but what I really want to do is create a new file so the original stays intact as a backup.
    I'd like to have a command to force Logic to point to this renamed, edited sound file instead of the original--without having to close and reopen the song.
    This would operate much in the same way as when one is prompted by Logic when it is unable to find a sound file upon opening a song. You get the can't-find-a-file dialogue with option to either search, or to manually point to the file. I just want to be able to force this on command while the song is open, as an audio bin command (not just when opening a song and Logic is unable to find a file)
    Currently, the way I deal with it is
    -close the Logic song
    -rename the original audio file temporarily, e.g., put a ~ in front of the file name.
    -use the "find manually" option when Logic says to find the file it can no longer find
    -point Logic to the edited and renamed version.
    -then once again, rename the original file back to its original name.
    Anyone have a simpler method?

    Thanks Frank!
    Got it. It worked.

  • Overlapping polygon and how to determine the points

    I have a larger footprint polygon/table called A and a sub-polygon/table called B.
    I need to identify which is polygon A and which is polygon B because they overlap with each other.
    And I need to identify all the point that falls within A and B.
    which means A = A and B = A+B and the other points that do notfall within A and B will be null.
    How do I start this assignment?
    I was thinking
    alter table A
    add  (ID varchar( 50 BYTE)) ;
    update A
    set ID = 'larger';
    --TO do a point in Polygon
    PROCEDURE point_polyA
    IS
         proc_name varchar2(50);
    BEGIN
         proc_name := 'point_polyA';
         add_log(proc_name,'Start processingpolyA');
         COMMIT;
         FOR x IN (SELECT id, geoloc
                       FROM A)
         LOOP     
              FOR y IN (SELECT a.*
                            FROM point
                           WHERE sdo_filter (A.geoloc, x.geoloc) = 'TRUE')
              LOOP               
                   IF sdo_geom.relate(y.geoloc, 'ANYINTERACT', x.geoloc, 5) = 'TRUE' THEN
                        INSERT INTO point_polyA ( id)
                             VALUES ( x.id);
                   END IF;          
              END LOOP;
              COMMIT;
         END LOOP;
         add_log(proc_name,'Finish!');
         COMMIT;
         EXCEPTION
                 WHEN OTHERS THEN
                    add_log(proc_name, substr(SQLCODE||' '||SQLERRM, 1, 199));
         COMMIT;Do the same for B then
    select ID
    from A,B
    where sdo_relate(A.geoloc,B.geoloc,'mask = contains') = 'TRUE';Message was edited by:
    CrackerJack

    Hi,
    this
    rownum<2
    making sure that only the one clicked polygon is rendered/displayed
    (pls see the [image of the screen |http://bp0.blogger.com/_8PXbvmaOB6M/SEe0rNCz4nI/AAAAAAAAAWo/lOHcLjbIz-U/s1600-h/verschneiden_snap3.png] )
    i.e. you click on the polygon of the area (county) and get the FOI as per Parameter 1 (which are the records/FOI contained in the first table "DEKUNDEN" = customers)
    in ur above code you will need to say:
    (b.geoloc, :1)
    recommend to firstly try to achieve a result with the delivered MVDEMO data.
    Then the SQL of the theme will look as follows:
    select a.location, a.name,
    a.city, a.sales from customers a where sdo_relate(a.location, (select
    geom from counties b where sdo_contains(b.geom, :1)='TRUE' and
    rownum&lt;2), 'mask=ANYINTERACT')='TRUE'
    re) attributes for both points and polygon
    --> for the points (customer table/theme) usually you get an Infowindow automatically for the theme "customers" for the "Info columns" you have defined in the ADVANCED Tab of the theme in the Mapbuilder.
    --> for the polygon you'll have to assign an info window on "mouse_right_cklick" as the "mouse-click" (left) has already been used for selelcting the polygon.
    and lastly I am not dealing with a webservice - just 2 tables: "customers" (with the POI - points) and "counties" (the polygon - area) from the MVDEMO example data.
    Hope that helped and I did not make more complicated - sorry - but it is quite complex (;-).
    Bernhard
    Edited by: BernhardFW on Aug 25, 2008 1:30 PM

  • Point inside a polygon defined by four points

    Hello everyone.
    In my java aplication, I need to know if a point is inside a polygon defined by four points. These points can have any value.
    A solution is:
    1)trace four lines: since the point to analyze until all the four points of the polygon.
    2)Calculate the angles formed between these lines.
    3)If the sum of the four angles is equal to 360�, the point is inside of the polygon.
    I think this could work, but i don�t know how to make this in java. Can anyone help me? Other solutions are welcome.
    Thanks.
    Fatima

    This is the code from the jazz api:
        static public boolean isInsidePolygon(double x, double y, int np, double[] xp, double[] yp) {
            int i;
            double angle = 0.0;
            boolean inside = false;
            for (i = 0; i < (np - 1); i++) {
                angle += ZUtil.angleBetweenPoints(x, y, xp, yp[i], xp[i+1], yp[i+1]);
    angle += ZUtil.angleBetweenPoints(x, y, xp[np-1], yp[np-1], xp[0], yp[0]);
    // Allow for a bit of rounding
    // Ideally, angle should be 2*pi.
    if (java.lang.Math.abs(angle) > 6.2) {
    inside = true;
    } else {
    inside = false;
    return inside;
    Here is the API, the above method is in ZUtil class.
    You can download the source code from the jazz api web site and examine it.

  • Problem with direction of points in sdo_ordinate_array

    i have created a polygon selection tool to create a polygon . I use sdo_relate function to get another point geometry from the polygon.
    SELECT a.cust_id
    FROM T_S_CUSTOMERS a
    WHERE SDO_RELATE(a.geometry,SDO_GEOMETRY(2003, 8307, NULL,
    SDO_ELEM_INFO_ARRAY(1,1003,1),
    SDO_ORDINATE_ARRAY("+lstcoordinates+")),
    'mask=anyinteract querytype=window') = 'TRUE';
    I want to find cust_id from this polygon .If i draw the polygon in anti clock wise direction , the query works but if i draw the polygon in clockwise direction , the query fails .
    Since the polygon will be drawn by user at the front end , I cannot restrict the direction in which user draws the polygon .User can also start drawing the polygon in clock wise direction then shift to anti clock wise direction to complete it. Is there any way
    through which i can get the result irrespective of user direction sense .

    The easiest way to ensure the polygon is counter-clockwise is to use this:
    SDO_MIGRATE.TO_CURRENT(
    geom IN SDO_GEOMETRY,
    dim IN SDO_DIM_ARRAY
    ) RETURN SDO_GEOMETRY;
    Example:
    SELECT sdo_migrate.to_current (SDO_GEOMETRY (2003,
    8307,
    NULL,
    sdo_elem_info_array (1, 1003, 1),
    sdo_ordinate_array (1, 1, 1, 2, 2, 2, 2, 1, 1, 1)
    sdo_dim_array (sdo_dim_element ('Longitude', -180, 180, .05),
    sdo_dim_element ('Latitude', -90, 90, .05)
    ) ccgeom
    FROM DUAL;
    CCGEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    SDO_GEOMETRY(2003, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(1, 1, 2, 1, 2, 2, 1, 2, 1, 1))

  • SDO_Relate does not return an interior point

    When I use SDO_Relate to try to find a point contained within a polygon, I can only get any results if the point actually lies on a boundary - the interior point is not detected, even with an ANYINTERACT filter. Here's an example:
    create table test (id NUMBER(10), shape mdsys.sdo_geometry);
    INSERT INTO USER_SDO_GEOM_METADATA
    (TABLE_NAME,
    COLUMN_NAME,
    DIMINFO,
    SRID) VALUES('test',
    'shape',
    MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('LONG', -180.0, 180.0, 1), MDSYS.SDO_DIM_ELEMENT('LAT', -90.0, 90.0, 1)),
    8307);
    create index test_idx on test(shape) indextype is MDSYS.SPATIAL_INDEX;
    insert into test values (1, SDO_GEOMETRY(2003, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(0,0, 0,-5, -5,-5, -5,0, 0,0)));
    SELECT id from test where SDO_RELATE(shape, SDO_GEOMETRY(2001, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(-2.5, -2.5)), 'mask=anyinteract') = 'TRUE';
    The above select statement returns no results...

    Hi Kent,
    In addition to fixing the data as Siva suggests, please see the following for more information regarding geodetic data:
    Re: problem with sdo_relate returning unexpected results
    Re: SDO_FILTER Bug in 10.2.0.1 and 10.1.0.2

  • Sdo_geom.concave_hull returns 'wrong' polygon

    The sdo_geom.sdo_concavehull function returns on some Multipoints a wrong Polygon.
    Some points of the calculated Polygon seem to be nearly in the middle of the Multipoint Geometry.
    It's hard to explain, so I made a screenshot from SQL Developer:
    [http://666kb.com/i/bxk5jz56tk7tthmbm.gif]
    The black dots is my Multipoint, the red line the result of sdo_geom.sdo_concavehull.
    Is the problem known? Is there any other way to create a concavehull?
    regards

    Not sure if this is the same problem as bug 12847220.
    If you'd like to, you can give us your data set, or contact oracle support.

  • Create a polygon via SQL

    I have an existing spatial/polygon table in my database. I want to join it to a view and load the join into a new spatial enabled polygon table. In case you are wondering the join is very slow. I am new to SQL Server spatial and cant find anything describing
    how to do this. Ultimately I will use SSIS to perform these steps for me. I have been able to do this with point data but not polygon. The existing polygon coordinates are in a Shape field and will load into another field of the same name. Here is the query
    I have built so far:
    select name, geography::Polygon(Shape, 4326) as Shape
    FROM View as c inner join ExistingPolygonTable as v
    on C.Name = v.Name
    Thanks in advance.
    Scott

    There is no Polygon static method like there is with Point. You can create a polygon from WKT (well-known text format) using these methods:
    http://technet.microsoft.com/en-us/library/bb933988.aspx Or use well-known binary, a standard binary format. But you don't have to convert a polygon from ExistingPolygonTable to string
    just to store it, just store it with the TSQL insert...select statement
    http://technet.microsoft.com/en-us/library/ms174335.aspx
    Or maybe I've misunderstood the question, or don't know what's in the ExistingPolygonTable. Or what format it's in in that table.
    Cheers, Bob

  • Arrow keys work too fast on Polygon tool

    My keyboard arrow keys change the amount of points/sides on the polygon tool too fast for me to control, and not one step at a time! How do I change this?

    Illy is getting too highstrung. Give her a cold turkey instead of whatever she is on. If necessary, you may get her unstrung if you Ctrl+Alt+Shift/Cmd+Option+Shift while you wake her or Move the folder while she sleeps.
    If that does not help, find out whether the arrow keys behave normally in other applications.

  • Polygon skewed during rotation

    I'm trying to rotate a polygon using AffineTransforms createTransformedShape routine which returns a GeneralPath Shape.
    I then copy the points from each segment in the GeneralPath back to my polygon. After multiple redraws of the polygon in paintcomponent the polygon becomes skewed. Apparently I'm losing accurate point information during the copy and cast to (int).
    I've attached a short version of my code including the problem , and I'd REALLY prefer to keep my data points stored in a Polygon instead of changing the whole program to work with GeneralPath Shape instead.
    Is there a way I can fix this skewing problem? Please help,
    thanks.
    (press spacebar to ciew the skewed result when running the program)
    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import javax.swing.*;
    public class PolygonRotation extends JPanel implements KeyListener{
         private static final long serialVersionUID = 1L;
         Polygon Polygon;
         Shape Poly;
         AffineTransform AT = new AffineTransform();
         PathIterator GPIterator;
         int SegmentType = 0;
         double[] PointsOnSegment = new double[6];
        protected void paintComponent(Graphics g){
             System.out.println("in paint component");
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            g.setColor(Color.red);
              ((Graphics2D)g).fill(Polygon);
         public void keyTyped(KeyEvent arg0) {
              // TODO Auto-generated method stub
         public void keyReleased(KeyEvent arg0) {
              // TODO Auto-generated method stub
        public void keyPressed(KeyEvent e) {
              System.out.println(e.getKeyCode());
              switch (e.getKeyCode()) {
                   case 32: //spacebar
                        rotate();
                        break;
                   default:
                        break;
              this.repaint();
         public void rotate() {          
              Point2D.Double p = getRotationPoint(Polygon);
              AT.setToIdentity();
              AT.translate(p.x, p.y);
              AT.rotate(Math.toRadians(45));
              AT.translate(-p.x, -p.y);
              //I must capture the rotated polygon as a Shape
              //(AT.createTransformedShape returns a GeneralPath)
              Poly = AT.createTransformedShape(Polygon);
              copyPath(Poly, Polygon);
        private Point2D.Double getRotationPoint(Polygon poly){
             int x = poly.xpoints[1];
              int y = poly.ypoints[1];
            return new Point2D.Double(x, y);
        private void copyPath(Shape path, Polygon poly){
              GPIterator = path.getPathIterator(AT);
             poly.reset();
              int tempx;
              int tempy;
              while (GPIterator.isDone() == false) {
                  SegmentType = GPIterator.currentSegment(PointsOnSegment);
                  tempx = (int)PointsOnSegment[0];
                   tempy = (int)PointsOnSegment[1];
                   if(SegmentType != 4){
                        poly.addPoint(tempx, tempy);
                   GPIterator.next();
        private void initPolygon(){
             Polygon = new Polygon();
            Polygon.addPoint(300, 300);
            Polygon.addPoint(300, 400);
            Polygon.addPoint(350, 400);
            Polygon.addPoint(350, 300);
        public static void main(String[] args){
            PolygonRotation pr = new PolygonRotation();
            pr.initPolygon();
            JFrame f = new JFrame();
              f.addKeyListener(pr);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(pr);
            f.setSize(600,600);
            f.setLocation(200,200);
            f.setVisible(true);
    }

    Thanks for your reply. I've tried this, but I think there is a bug in the code returning the "Shape" from the createTransformedShape() method call.
    For example. If I call translate(0, 20) it will be drawn with the correct translation, but printing the "Shape" object points will reveal a shift of translate(0, 40)! I don't believe my code could have created this issue.
    Shape tempShape = AT.createTransformedShape(Polygon);
    PathIterator GPIterator = tempShape.getPathIterator(AT);
              while (GPIterator.isDone() == false) {
                  SegmentType = GPIterator.currentSegment(PointsOnSegment);
                  System.out.println("point: " + PointsOnSegment[0] + ", " + PointsOnSegment[1]);
                   GPIterator.next();
              }The problem is that I can't do accurate collision checking when the "Shape" points retrieved are not the same as those of the rendered Polygon!
    Am I crazy or is there a bug in the source?
    I'm using jdk1.5.0_06
    What do you think? thanks,

  • Polygon mouse events

    Hi, lets suppose that I have a graph of polygons (By graph I mean that different polygons may share certain points.
    Now, imagine each polygon is actually kept in a separate jcomponent, and painted in the paintComponent() method.
    Now, even though the polygons do not over-lap (they form a graph remember), the bounding boxes do!
    So, I am no longer able to get any meaningful mouse events (based on which polygon is actually selected). Instead, I will just get which jcomponent's bounding box is selected.
    Now, if I want all of these events to be generated and received as a result of the mouse entereing the actual polygon or selecting a point in the actual polygon (instead of the bounding box), what will be the best way to do this.
    Sorry if I was unclear...
    Thanks,
    -Steven

    Thanks, I wasn't aware that this was the method used by mouse events.

  • Custom graphics in java.awt.ScrollPane

    Hi all,
    I have to draw a custom created image in a scroll pane. As the image is very large I want to display it in a scroll pane. As parts of the image may change within seconds, and drawing the whole image is very time consuming (several seconds) I want to draw only the part of the image that is currently visible to the user.
    My idea: creating a new class that extends from java.awt.ScrollPane, overwrite the paint(Graphics) method and do the drawings inside. Unfortunately, it does not work. The background of the scoll pane is blue, but it does not show the red box (the current viewport is not shown in red).
    Below please find the source code that I am using:
    package graphics;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.ScrollPane;
    import java.awt.event.AdjustmentEvent;
    public class CMyComponent extends ScrollPane {
         /** <p>Listener to force a component to repaint when a scroll bar changes its
          * position.</p>
         private final class ScrollBarAdjustmentListener implements java.awt.event.AdjustmentListener {
              /** <p>The component to force to repaint.</p> */
              private final Component m_Target;
              /** <p>Default constructor.</p>
               * @param Target The component to force to repaint.
              private ScrollBarAdjustmentListener(Component Target) { m_Target = Target; }
              /** <p>Forces to component to repaint upon adjustment of the scroll bar.</p>
               *  @see java.awt.event.AdjustmentListener#adjustmentValueChanged(java.awt.event.AdjustmentEvent)
              public void adjustmentValueChanged(AdjustmentEvent e) { m_Target.paint(m_Target.getGraphics()); }
         public CMyComponent() {
              // Ensure that the component repaints upon changing of the scroll bars
              ScrollBarAdjustmentListener sbal = new ScrollBarAdjustmentListener(this);
              getHAdjustable().addAdjustmentListener(sbal);
              getVAdjustable().addAdjustmentListener(sbal);
         public void paint(Graphics g) {
              setBackground(Color.BLUE);
              g.setColor(Color.RED);
              g.fillRect(getScrollPosition().x, getScrollPosition().y, getViewportSize().width, getViewportSize().height);
         public final static void main(String[] args) {
              java.awt.Frame f = new java.awt.Frame();
              f.add(new CMyComponent());
              f.pack();
              f.setVisible(true);
    }

    Dear all,
    I used the last days and tried several things. I think now I have a quite good working solution (just one bug remains) and it is very performant. To give others a chance to see what I have done I post the source code of the main class (a canvas drawing and implementing scrolling) here. As soon as the sourceforge project is accepted, I will publish the whole sources at there. Enjoy. And if you have some idea for my last bug in getElementAtPixel(Point), then please tell me.
    package internetrail.graphics.hexgrid;
    import java.awt.Canvas;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Image;
    import java.awt.Point;
    import java.awt.Polygon;
    import java.awt.event.ComponentEvent;
    import java.awt.event.ComponentListener;
    import java.awt.geom.Area;
    import java.awt.image.BufferedImage;
    import java.util.WeakHashMap;
    import java.util.Map;
    /** <p>Hex grid view.</p>
    * <p>Visualizes a {@link IHexGridModel}.</p>
    * @version 0.1, 03.06.2006
    * @author Bjoern Wuest, Germany
    public final class CHexGridView extends Canvas implements ComponentListener, IHexGridElementListener {
         /** <p>Serial version unique identifier.</p> */
         private static final long serialVersionUID = -965902826101261530L;
         /** <p>Instance-constant parameter for the width of a hex grid element.</p> */
         public final int CONST_Width;
         /** <p>Instance-constant parameter for 1/4 of the width of a hex grid element.</p> */
         public final int CONST_Width1fourth;
         /** <p>Instance-constant parameter for 3/4 of the width of a hex grid element.</p> */
         public final int CONST_Width3fourth;
         /** <p>Instance-constant parameter for 1.5 times of the width of a hex grid element.</p> */
         public final int CONST_Width1dot5;
         /** <p>Instance-constant parameter for 4 times of the width of a hex grid element.</p> */
         public final int CONST_Widthquad;
         /** <p>Instance-constant parameter for the height of a hex grid element.</p> */
         public final int CONST_Height;
         /** <p>Instance-constant parameter for 1/2 of the height of a hex grid element.</p> */
         public final int CONST_Heighthalf;
         /** <p>Instance-constant parameter for the double height of a hex grid element.</p> */
         public final int CONST_Heightdouble;
         /** <p>The steepness of a side of the hex grid element (calculated for the upper left arc).</p> */
         public final double CONST_Steepness;
         /** <p>The model of this hex grid </p> */
         private final IHexGridModel m_Model;
         /** <p>A cache for already created images of the hex map.</p> */
         private final Map<Point, Image> m_Cache = new WeakHashMap<Point, Image>();
         /** <p>The graphical area to draw the selection ring around a hex element.</p> */
         private final Area m_SelectionRing;
         /** <p>The image of the selection ring around a hex element.</p> */
         private final BufferedImage m_SelectionRingImage;
         /** <p>The current position of the hex grid in pixels (top left visible corner).</p> */
         private Point m_ScrollPosition = new Point(0, 0);
         /** <p>Flag to define if a grid is shown ({@code true}) or not ({@code false}).</p> */
         private boolean m_ShowGrid = true;
         /** <p>Flag to define if the selected hex grid element should be highlighted ({@code true}) or not ({@code false}).</p> */
         private boolean m_ShowSelected = true;
         /** <p>The offset of hex grid elements shown on the screen, measured in hex grid elements.</p> */
         private Point m_CurrentOffset = new Point(0, 0);
         /** <p>The offset of the image shown on the screen, measured in pixels.</p> */
         private Point m_PixelOffset = new Point(0, 0);
         /** <p>The index of the currently selected hex grid element.</p> */
         private Point m_CurrentSelected = new Point(0, 0);
         /** <p>The width of a buffered pre-calculated image in pixel.</p> */
         private int m_ImageWidth;
         /** <p>The height of a buffered pre-calculated image in pixel.</p> */
         private int m_ImageHeight;
         /** <p>The maximum number of columns of hex grid elements to be shown at once on the screen.</p> */
         private int m_MaxColumn;
         /** <p>The maximum number of rows of hex grid elements to be shown at once on the screen.</p> */
         private int m_MaxRow;
         /** <p>Create a new hex grid view.</p>
          * <p>The hex grid view is bound to a {@link IHexGridModel} and registers at
          * that model to listen for {@link IHexGridElement} updates.</p>
          * @param Model The model backing this view.
         public CHexGridView(IHexGridModel Model) {
              // Set the model
              m_Model = Model;
              CONST_Width = m_Model.getElementsWidth();
              CONST_Height = m_Model.getElementsHeight();
              CONST_Width1fourth = CONST_Width/4;
              CONST_Width3fourth = CONST_Width*3/4;
              CONST_Width1dot5 = CONST_Width*3/2;
              CONST_Heighthalf = CONST_Height/2;
              CONST_Widthquad = CONST_Width*4;
              CONST_Heightdouble = CONST_Height*2;
              CONST_Steepness = (double)CONST_Heighthalf / CONST_Width1fourth;
              m_ImageWidth = getSize().width+CONST_Widthquad;
              m_ImageHeight = getSize().height+CONST_Heightdouble;
              m_MaxColumn = m_ImageWidth / CONST_Width3fourth;
              m_MaxRow = m_ImageHeight / CONST_Height;
              // Register this canvas for various notifications
              m_Model.addElementListener(this);
              addComponentListener(this);
              // Create the selection ring to highlight hex grid elements
              m_SelectionRing = new Area(new Polygon(new int[]{-1, CONST_Width1fourth-1, CONST_Width3fourth+1, CONST_Width+1, CONST_Width3fourth+1, CONST_Width1fourth-1}, new int[]{CONST_Heighthalf, -1, -1, CONST_Heighthalf, CONST_Height+1, CONST_Height+1}, 6));
              m_SelectionRing.subtract(new Area(new Polygon(new int[]{2, CONST_Width1fourth+2, CONST_Width3fourth-2, CONST_Width-2, CONST_Width3fourth-2, CONST_Width1fourth+2}, new int[]{CONST_Heighthalf, 2, 2, CONST_Heighthalf, CONST_Height-2, CONST_Height-2}, 6)));
              m_SelectionRingImage = new BufferedImage(CONST_Width, CONST_Height, BufferedImage.TYPE_INT_ARGB);
              Graphics2D g = m_SelectionRingImage.createGraphics();
              g.setColor(Color.WHITE);
              g.fill(m_SelectionRing);
         @Override public synchronized void paint(Graphics g2) {
              // Caculate the offset of indexes to show
              int offsetX = 2 * (m_ScrollPosition.x / CONST_Width1dot5) - 2;
              int offsetY = (int)(Math.ceil(m_ScrollPosition.y / CONST_Height) - 1);
              m_CurrentOffset = new Point(offsetX, offsetY);
              // Check if the image is in the cache
              Image drawing = m_Cache.get(m_CurrentOffset);
              if (drawing == null) {
                   // The image is not cached, so draw it
                   drawing = new BufferedImage(m_ImageWidth, m_ImageHeight, BufferedImage.TYPE_INT_ARGB);
                   Graphics2D g = ((BufferedImage)drawing).createGraphics();
                   // Draw background
                   g.setColor(Color.BLACK);
                   g.fillRect(0, 0, m_ImageWidth, m_ImageHeight);
                   // Draw the hex grid
                   for (int column = 0; column <= m_MaxColumn; column += 2) {
                        for (int row = 0; row <= m_MaxRow; row++) {
                             // Draw even column
                             IHexGridElement element = m_Model.getElementAt(offsetX + column, offsetY + row);
                             if (element != null) { g.drawImage(element.getImage(m_ShowGrid), (int)(column*(CONST_Width3fourth-0.5)), CONST_Height*row, null); }
                             // Draw odd column
                             element = m_Model.getElementAt(offsetX + column+1, offsetY + row);
                             if (element!= null) { g.drawImage(element.getImage(m_ShowGrid), (int)(column*(CONST_Width3fourth-0.5)+CONST_Width3fourth), CONST_Heighthalf*(row*2+1), null); }
                   // Put the image into the cache
                   m_Cache.put(m_CurrentOffset, drawing);
              // Calculate the position of the image to show
              offsetX = CONST_Width1dot5 + (m_ScrollPosition.x % CONST_Width1dot5);
              offsetY = CONST_Height + (m_ScrollPosition.y % CONST_Height);
              m_PixelOffset = new Point(offsetX, offsetY);
              g2.drawImage(drawing, -offsetX, -offsetY, null);
              // If the selected element should he highlighted, then do so
              if (m_ShowSelected) {
                   // Check if the selected element is on screen
                   if (isElementOnScreen(m_CurrentSelected)) {
                        // Correct vertical offset for odd columns
                        if ((m_CurrentSelected.x % 2 == 1)) { offsetY -= CONST_Heighthalf; }
                        // Draw the selection circle
                        g2.drawImage(m_SelectionRingImage, (m_CurrentSelected.x - m_CurrentOffset.x) * CONST_Width3fourth - offsetX - ((m_CurrentSelected.x + 1) / 2), (m_CurrentSelected.y - m_CurrentOffset.y) * CONST_Height - offsetY, null);
         @Override public synchronized void update(Graphics g) { paint(g); }
         public synchronized void componentResized(ComponentEvent e) {
              // Upon resizing of the component, adjust several pre-calculated values
              m_ImageWidth = getSize().width+CONST_Widthquad;
              m_ImageHeight = getSize().height+CONST_Heightdouble;
              m_MaxColumn = m_ImageWidth / CONST_Width3fourth;
              m_MaxRow = m_ImageHeight / CONST_Height;
              // And flush the cache
              m_Cache.clear();
         public void componentMoved(ComponentEvent e) { /* do nothing */ }
         public void componentShown(ComponentEvent e) { /* do nothing */ }
         public void componentHidden(ComponentEvent e) { /* do nothing */ }
         public synchronized void elementUpdated(IHexGridElement Element) {
              // Clear cache where the element may be contained at
              for (Point p : m_Cache.keySet()) { if (isElementInScope(Element.getIndex(), p, new Point(p.x + m_MaxColumn, p.y + m_MaxRow))) { m_Cache.remove(p); } }
              // Update the currently shown image if the update element is shown, too
              if (isElementOnScreen(Element.getIndex())) { repaint(); }
         /** <p>Returns the model visualized by this grid view.</p>
          * @return The model visualized by this grid view.
         public IHexGridModel getModel() { return m_Model; }
         /** <p>Returns the current selected hex grid element.</p>
          * @return The current selected hex grid element.
         public IHexGridElement getSelected() { return m_Model.getElementAt(m_CurrentSelected.x, m_CurrentSelected.y); }
         /** <p>Sets the current selected hex grid element by its index.</p>
          * <p>If the selected hex grid element should be highlighted and is currently
          * shown on the screen, then this method will {@link #repaint() redraw} this
          * component automatically.</p>
          * @param Index The index of the hex grid element to become the selected one.
          * @throws IllegalArgumentException If the index refers to a non-existing hex
          * grid element.
         public synchronized void setSelected(Point Index) throws IllegalArgumentException {
              // Check that the index is valid
              if ((Index.x < 0) || (Index.y < 0) || (Index.x > m_Model.getXElements()) || (Index.y > m_Model.getYElements())) { throw new IllegalArgumentException("There is no hex grid element with such index."); }
              m_CurrentSelected = Index;
              // If the element is on screen and should be highlighted, then repaint
              if (m_ShowSelected && isElementOnScreen(m_CurrentSelected)) { repaint(); }
         /** <p>Moves the visible elements to the left by the number of pixels.</p>
          * <p>To move the visible elements to the left by one hex grid element, pass
          * {@link #CONST_Width3fourth} as the parameter. The component will
          * automatically {@link #repaint()}.</p>
          * @param Pixels The number of pixels to move to the left.
          * @return The number of pixels moved to the left. This is always between 0
          * and {@code abs(Pixels)}.
         public synchronized int moveLeft(int Pixels) {
              int delta = m_ScrollPosition.x - Math.max(0, m_ScrollPosition.x - Math.max(0, Pixels));
              if (delta != 0) {
                   m_ScrollPosition.x -= delta;
                   repaint();
              return delta;
         /** <p>Moves the visible elements up by the number of pixels.</p>
          * <p>To move the visible elements up by one hex grid element, pass {@link
          * #CONST_Height} as the parameter. The component will automatically {@link
          * #repaint()}.</p>
          * @param Pixels The number of pixels to move up.
          * @return The number of pixels moved up. This is always between 0 and {@code
          * abs(Pixels)}.
         public synchronized int moveUp(int Pixels) {
              int delta = m_ScrollPosition.y - Math.max(0, m_ScrollPosition.y - Math.max(0, Pixels));
              if (delta != 0) {
                   m_ScrollPosition.y -= delta;
                   repaint();
              return delta;
         /** <p>Moves the visible elements to the right by the number of pixels.</p>
          * <p>To move the visible elements to the right by one hex grid element, pass
          * {@link #CONST_Width3fourth} as the parameter. The component will
          * automatically {@link #repaint()}.</p>
          * @param Pixels The number of pixels to move to the right.
          * @return The number of pixels moved to the right. This is always between 0
          * and {@code abs(Pixels)}.
         public synchronized int moveRight(int Pixels) {
              int delta = Math.min(m_Model.getXElements() * CONST_Width3fourth + CONST_Width1fourth - getSize().width, m_ScrollPosition.x + Math.max(0, Pixels)) - m_ScrollPosition.x;
              if (delta != 0) {
                   m_ScrollPosition.x += delta;
                   repaint();
              return delta;
         /** <p>Moves the visible elements down by the number of pixels.</p>
          * <p>To move the visible elements down by one hex grid element, pass {@link
          * #CONST_Height} as the parameter. The component will automatically {@link
          * #repaint()}.</p>
          * @param Pixels The number of pixels to move down.
          * @return The number of pixels moved down. This is always between 0 and
          * {@code abs(Pixels)}.
         public synchronized int moveDown(int Pixels) {
              int delta = Math.min(m_Model.getYElements() * CONST_Height + CONST_Heighthalf - getSize().height, m_ScrollPosition.y + Math.max(0, Pixels)) - m_ScrollPosition.y;
              if (delta != 0) {
                   m_ScrollPosition.y += delta;
                   repaint();
              return delta;
         /** <p>Checks if the hex grid element of the given index is currently
          * displayed on the screen (even just one pixel).</p>
          * <p>The intention of this method is to check if a {@link #repaint()} is
          * necessary or not.</p>
          * @param ElementIndex The index of the element to check.
          * @return {@code true} if the hex grid element of the given index is
          * displayed on the screen, {@code false} if not.
         public synchronized boolean isElementOnScreen(Point ElementIndex) { return isElementInScope(ElementIndex, m_CurrentOffset, new Point(m_CurrentOffset.x + m_MaxColumn, m_CurrentOffset.y + m_MaxRow)); }
         /** <p>Checks if the hex grid element of the given index is within the given
          * indexes.</p>
          * <p>The intention of this method is to check if a {@link #repaint()} is
          * necessary or not.</p>
          * @param ElementIndex The index of the element to check.
          * @param ReferenceIndexLeftTop The left top index of the area to check.
          * @param ReferenceIndexRightBottom The right bottom index of the area to check.
          * @return {@code true} if the hex grid element of the given index is within
          * the given area, {@code false} if not.
         public synchronized boolean isElementInScope(Point ElementIndex, Point ReferenceIndexLeftTop, Point ReferenceIndexRightBottom) { if ((ElementIndex.x >= ReferenceIndexLeftTop.x) && (ElementIndex.x <= ReferenceIndexRightBottom.x) && (ElementIndex.y >= ReferenceIndexLeftTop.y) && (ElementIndex.y <= (ReferenceIndexRightBottom.y))) { return true; } else { return false; } }
         /** <p>Return the {@link IHexGridElement hex grid element} shown at the given
          * pixel on the screen.</p>
          * <p><b>Remark: There seems to be a bug in retrieving the proper element,
          * propably caused by rounding errors and unprecise pixel calculations.</p>
          * @param P The pixel on the screen.
          * @return The {@link IHexGridElement hex grid element} shown at the pixel.
         public synchronized IHexGridElement getElementAtPixel(Point P) {
              // @FIXME Here seems to be some bugs remaining
              int dummy = 0; // Variable for warning to indicate that there is something to do :)
              // Calculate the pixel on the image, not on the screen
              int px = P.x + m_PixelOffset.x;
              int py = P.y + m_PixelOffset.y;
              // Determine the x-index of the column (is maybe decreased by one)
              int x = px / CONST_Width3fourth + m_CurrentOffset.x;
              // If the column is odd, then shift the y-pixel by half element height
              if ((x % 2) == 1) { py -= CONST_Heighthalf; }
              // Determine the y-index of the row (is maybe decreased by one)
              int y = py / CONST_Height + m_CurrentOffset.y;
              // Normative coordinates to a single element
              px -= (x - m_CurrentOffset.x) * CONST_Width3fourth;
              py -= (y - m_CurrentOffset.y) * CONST_Height;
              // Check if the normative pixel is in the first quarter of a column
              if (px < CONST_Width1fourth) {
                   // Adjustments to the index may be necessary
                   if (py < CONST_Heighthalf) {
                        // We are in the upper half of a hex-element
                        double ty = CONST_Heighthalf - CONST_Steepness * px;
                        if (py < ty) { x--; }
                   } else {
                        // We are in the lower half of a hex-element
                        double ty = CONST_Heighthalf + CONST_Steepness * px;
                        if (py > ty) {
                             x--;
                             y++;
              return m_Model.getElementAt(x, y);
    }Ah, just to give you some idea: I use this component to visualize a hex grid map with more than 1 million grid elements. And it works, really fast, and requires less than 10 MByte of memory.

  • OBIEE 11g Map question

    Hi all,
    We are using OBIEE 11g Mapviewer to display some results. We have point as well as polygon location geometries which combined with other dimensions display scores on the map.
    It seems there is a restriction on the display graphics that can be used based on a geometry type. It is something like the following table:
    Geometry Type - Graphic Format
    Polygon - Color Fill, Bubble, Pie Graph, and Bar Graph
    Point - Bubble, Variable Shape, Image, and Custom Point
    We display a pie graph of scores on a given polygon and would like to keep it standard irrespective of the underlying geometry.
    I was wondering if its possible to force use a Pie Graph on Point geometry?
    Please let us know if there is a way to solve this. Really appreciate your time.
    Thanks!

    Hi
    Your best bet is to follow the Security Guide:
    http://docs.oracle.com/cd/E20490_01/bia.7963/e19042.pdf
    Really you just need to make sure the Responsibility names are the same as the Application Roles. So either you create new responsibilities in EBS to match the existing (seeded) roles or you create new roles in OBI Apps to match your existing responsibilites. Both ways round are valid and it all depends on your security solution.
    Thanks
    Robin

  • I would like some help in determining the proper structure/implementation

    I would like some help in determining the proper structure/implementation for the following scenario:
    I have ~10 steel rods that have been equipped with a strain gauge.  The most I would have is ~30 steel rods.
    Each setup has had a 10 point calibration done.
    These steel rod/strain gauge setups are assigned a calibration number.
    The data would be grouped for each steel rod and identified by the calibration number. 
    I would like to use that calibration data to determine the Young’s Modulus for each steel rod and store that within the specific rod’s information.
    I want the user to be able to add new steel rods dynamically and the Young’s Modulus calculated and stored with it.
    There are two different types of rods.
    The cross-sectional area of the rod needs to be stored and that value is constant based on the rod type (so there are two different area values).
    After a rod’s calibration data is entered the first time, the data should be static so it doesn’t need to be re-entered.
    The user would enter the cal#, the 10 point calibration data, and the rod type.
    The user will only see the steel rod cal# on the FP.
    I am using a queue-based producer/consumer with event structure for the front panel interface.  So I’m thinking whenever a rod cal# was added I would call a subvi where the calibration data can be entered and then the Young’s Modulus could be calculated and stored.  An option to edit/review existing cal data should be available.
    LabVIEW 2010, Win 7.
    My initial idea was:
    Rod Arr – array of clusters:
    Rod Info - cluster:
    Calibration number – string
    Rod Scale cluster:
    mV/V – double array
    force – double array
    Young’s Modulus – double
    Rod type – enum
    Cross-sectional area – double
    I have not implemented this because I’m not sure how to implement that AND keep the data after it’s been entered.  And all of the bundling/unbundling anytime I want to access/edit any rod information can be BD consuming.  I thought a lookup table might work.  When I looked on the forums for a lookup table I was pointed in the direction of arrays/clusters.
    So I have two questions:
    What would be the best structure for the steel rod data?
    What would be the best data type for the calibration# that the user can edit (enum, ring, ?)?

    I would make a couple of small change to your proposed data layout (highlighted in blue):
    Rod Arr – array of clusters:
    Rod Info - cluster:
    Calibration number – string
    Array of Rod Scale cluster:
    mV/V – double
    force – double
    Young’s Modulus – double
    Rod type – enum
    Cross-sectional area – double
    For the calibration data, I would have an array of clusters rather than a cluster of arrays.  IMHO, this makes it easier to index through the calibration points, and makes it less likely you will ever have a situation where you don't have the same number of mV/V and force points.  I'd also move the Young's modulus, type, and area info into the Rod Info cluster.
    I prefer to store this type of configuration in the system registry, but that is more complicated and far from universal in the LabVIEW world.  A simpler way would be to simply pass the entire array to the "write to binary file" function.  If you do this, however, you might want to add a version number, otherwise it will be very difficult to maintain backwards compatibility if you ever need to change the data structure.
    As far as the control type, it depends on what the user is entering.  If the user is mostly entering calibration numbers already in the system, I would use a (system) combo box.  This allows the user to select an existing calibration number from the menu, but also to enter a new calibration number if they need to.  If the user will almost always enter new calibration numbers, then I would use a standard string control.  Either way, you'll probably want to validate the format of the number the user enters.
    Mark Moss
    Electrical Validation Engineer
    GHSP

  • How do i duplicate and mirror a mask

    Using Photoshop CC I have created an image with a very difficult multi point select tool (the polygon lasso tool), layer mask and box filter. Instead of redrawing the multi point selection again is there a way to duplicate just the mask and i know I can flip an individual layer horizontal before moving the image to the canvas. I tried and succeeded once but be damned if I can remember how i did it. I will need to repeat and flip a bunch of images so using this ability to quickly dup and flip a mask would be very helpful. Like I said I did it once already so I know it is possible. I have been trying again but have not stumbled upon it yet. If I do figure it out again I will gladly post it here.
    Thanks for your time. Tom

    You can duplicate a mask by holding down the alt/opt key while dragging the mask to another layer.
    You can hold down the ctrl/cmd key to create a selection when clicking on the mask
    You will find the horizontal and vertical commands in the edit menu's transform sub menu.
    If you save the selection in the selection menu (this will place the mask in the channels panel) you can click on that thumbnail in the channels panel to edit the mask as though it is an image. Which would allow you to flip it. You can then load the selection in the selections menu to use that mask as a selection.
    If something does not work as I describe, please let me know. I am going from memory, I can run photoshop to verify if needed.

Maybe you are looking for

  • File size corruption

    This seems to be more an annoyance than a problem but when I connect my 80g ipod to itunes it seems to corrupt the file size. As such about 2/3rds of the 8000 or so songs I have on it list the size of each song at 623,826 gb. It changes to the actual

  • Asset capitalization in specific ledgers/depreciation areas

    Scenario: Example: Leading Ledger 0L: IFRS- Book depreciation 01 in AA u2013Posting to GL Non Leading Ledger  Z0: US GAAP Depreciation Area 04 in AA- Posting to GL Non leading ledger Z1 :JP GAAP:  No depreciation area in AA ( We donu2019t want to cap

  • Extreme heat when on charge

    hey everyone, i just bought my macbook pro yesterday.( new 15" 2.2GHz i7 processor) i put it on charge while using it and it became really hot. also when I'm on Skype the fan starts spinning a lot and my macbook heats up and i cant keep it on my lap.

  • Round value in java script

    hi, I have to calculate Salary into textfield . Problem is after Calculation salary amount 1230.3566678787 like this come into text field. i want only 1230.35 amount. <script> function multiplyItems(){ function getVal(item){ if($x(item).value != "")

  • How to active SAP for Retail

    Hi All, we completed install SAP system. but now we can not active SAP for Retail. pls let me know how to active SAP for Retail Thanks and Best Rgrds