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.

Similar Messages

  • Point in Polygon/Rectangle problem.

    Hi,
    I'm want to find out, what points in my DB are inside an user-defined area.
    If I have a rectangle and treat it like a rectangle in the query:
    SELECT * FROM TABLE WHERE
    sdo_relate(point, mdsys.sdo_geometry(2003,8307,null,
    mdsys.sdo_elem_info_array(1,1003,3),
    mdsys.sdo_ordinate_array(-30,-30, 30,30)),
    'mask=INSIDE querytype=window layer_gtype=point') = 'TRUE'
    ...everything is ok.
    If I take the same geometry and use it as an polygon in the query:
    SELECT * FROM TABLE WHERE
    sdo_relate(point, mdsys.sdo_geometry(2003,8307,null,
    mdsys.sdo_elem_info_array(1,1003,1),
    mdsys.sdo_ordinate_array(-30,-30, 30,-30, 30,30, -30,30, -30,-30 )),
    'mask=INSIDE querytype=window layer_gtype=point') = 'TRUE'
    ...the result is wrong, there are lots of points that are definitely outside the area. The number of errors is rising the bigger the choosen area becomes.
    Any idea?
    Best regards
    Florian

    wateenmooiedag,
    this seems to work. Thanks.
    But: if I make the query window very large, than again I have wrong results.
    Here: http://gdsg.ngdc.noaa.gov/spatial_cookbook.html I found the sentence:
    Also, this query will not return the correct number of records if the selection area > one-half the surface of the earth
    This is exactly what I'm experienced.
    Now I ask myself: how should I use Oracle Spatial if it's not possible to aks for points that are inside a certain polygon (even if the polygon is more than half the world) ??
    siva,
    I understand what you mean.
    But in my case, the problem is not that I get little differences between the rectangle and the polygon. If I use the polygon, I get completely wrong results.
    For example: my query window is mdsys.sdo_ordinate_array(-100,-80, 100,-80, 100,80, -100,80, -100,-80 ), than I only get results that are outside the longitude area (-180 to -100 and 100 to 180).
    For me this seems to be a bug.
    Best regards,
    Florian

  • Connection between 2 points in a geodetic coordinate system

    In a geodetic coordinate system the connection between two points is a geodetic line or "great circle" (the shortest connection between two points on the surface of the earth).
    Since Oracle 9i distances and queries like "Is a point outside or inside the polygon" are computed correctly for a geodetic coordinate system.
    Even though a circle or arc is not allowed in a geodetic coordinate system (like WGS84 - SRID 8307)
    arcs and circles are used in geographic applications like aeronautical maps.
    Frequently a special area is defined like this "10 nautical miles around airport XXXX"
    and this area is shown as a circle in aeronautical maps (in the projection).
    The function SDO_UTIL.CIRCLE_POLYGON (in Oracle 10g) is very useful to construct such kind of areas and for queries like
    "Does the area belonging to airport XXXX overlap with the area belonging to airport YYYY?".
    For Oracle 8i we had to write special PL/SQL code.
    Another type of connection between two points that is frequently used is a line of equal latitude (parallel).
    Many boundaries are defined like "from meridian (longitude) 30°E to meridian 31°E along parallel 47.5°N".
    If this line is a border of a polygon and if we use a direct connection (geodetic line) and we ask if a point is
    inside or outside the polygon, we will not get the correct answer if the point is close north to this line.
    We have to approximate the line and add points e.g. every 0.1° longitude (30.1,30.2,30.3...), then the answer will be correct.
    My question:
    Are there plans to support circles of equal latitude or generally rhumb lines as a type of connection between two points?
    Karl Mann

    There are no plans to support rhumb lines, also know as loxodromes, and including the special case of parallels of latitude, at this time. Note that it is easy to simulate such rhumb lines with a sufficiently dense set of sampled points. Such a densification is implemented implicitly for parallels in the VIEWPORT_TRANSFORM function so that the concept of the "geodetic minimum bounding rectangle" can be supported, primarily for visualization applications.

  • Using Xcontrols in the user defined express vi's

    Hi All,
                            I am actually using a Xcontrol inside a user defined express that we develop. The xcontrol is working as expected when i use it in the standard vis. But when i use it in the express, simply it crashes the LabVIEW and i need to restart the LabVIEW again. I am worried with this.
                            I put break points in the Facade vi of the xcontrol to know what is happening. But, i am not able to debug as the configure vi comes infront as modal even though the Source, sub and the configure vi of the express was not been configured as modal.
                        How to solve this problem?
                        Is there any restriction in using xcontrol with express vi's?
                        I am refering the Express Tool Kit Manual.pdf. Is there any other documents to know about the operation of the express vi's?
    Thanks,
    Pandiarajan R

    Hello Pandiarajan,
    Since I didn't see it mentioned, I'm going to presume (hope) you're using 8.0.  In LabVIEW 8.0, certain parts of XControls ran in a different application instance than where the VI was.  This was a source of many issues related to XControls.  In your case, since Express VI configuration pages also run in a separate application instance (and a different one than the XControls), I suspect this is related to the problems you are seeing.  If this is the case, it may not be possible to use an XControl on the front panel of an Express VI config page in 8.0.
    The resolution to many of these issues was to allow these XControl parts to run in the application instance of the VI whose front panel contains the XControl.  This fairly substantial change did not make it in until LabVIEW 8.2.
    If you are already using LabVIEW 8.2, it may not be an easy issue to troubleshoot, but I'd like to help isolate this issue.  If you can simplify your XControl / Express VI into something that you could package and attach to this thread, I'd be willing to take a look at it.

  • Maximum and 2nd longest diameters of polygon

    I have a polygon in the form of a Point[] of Cartesian (x, y) pairs� for the sake of argument lets just say it�s a simple closed loop and no crossing sections and I would like to calculate the second longest perpendicular diameter based on the maximum diameter which I have obtained by the following code:
        public boolean longestDiameter(Point[] points) {
            Point currentPoint;
            Point focusPoint;
            double maxDistance = 0.0;
            double currentDistance = 0.0;
            boolean contains = false;
            Line2D.Double diameter;
            for(int i = 0; i < points.length; i++) {
                focusPoint = points;
    for(int j = 0; j < points.length; j++) {
    currentPoint = points[j];
    currentDistance = focusPoint.distance(currentPoint);
    if(!focusPoint.equals(currentPoint)) {
    diameter = new Line2D.Double(focusPoint, currentPoint);
    // System.out.println("Current Point: X " + currentPoint.getX() + " Y " + currentPoint.getY());
    // System.out.println("Diameter Points: X1 " + diameter.getX1() + " Y1 " + diameter.getY1() +
    // " X2 " + diameter.getX2() + " Y2 " + diameter.getY2());
    // contains = checkLineContainment(diameter, points);
    // contains = checkLineContainment(getLinePoints(diameter), points);
    contains = true;
    if((maxDistance < currentDistance) && contains) {
    maxDistance = currentDistance;
    longestDiameterPoints[0] = focusPoint;
    longestDiameterPoints[1] = currentPoint;
    if(maxDistance == 0.0)
    return false;
    return true;
    You�ll notice that I have checkLineContainment as a separate function. Basically I wrote this Boolean function to check to see if the points along the variable called diameter are contained inside the polygon, but I forced it to true for now. I also wrote a getLinePoints method because to my knowledge JDK 1.4.1 doesn�t have a built in iterator which will provide a point by point array of the individual points on a line:
    Its pretty long winded but it accounts for all possible slopes that you might expect, depending on where the two points being compared lie in relation to one another. This should provide me with a point by point vector which I can then use the opposite inverse slope of the maximum line to proceed in my calculation of the second longest diameter but it doesn�t.
        // Gets the integer line points from a line and stores them in a vector
        public Vector getLinePoints(Line2D.Double line) {
            Vector linePoints = new Vector();
            Point2D startPoint = line.getP1();
            Point2D endPoint = line.getP2();
            Point2D currentPoint = startPoint;
            double deltaY = (endPoint.getY() - startPoint.getY());
            double deltaX = (endPoint.getX() - startPoint.getX());
            double slope = 0.0;
            if(deltaX != 0) {
                slope = deltaY / deltaX;
                System.out.println("Slope: " + slope);
            double b = (startPoint.getY() - slope*startPoint.getX());
            while(!currentPoint.equals(endPoint)) {
                System.out.println("CurrentPoint X: " + currentPoint.getX() + " Y: " + currentPoint.getY());
                System.out.println("StartPoint X: " + startPoint.getX() + " Y: " + startPoint.getY());
                System.out.println("EndPoint X: " + endPoint.getX() + " Y: " + endPoint.getY());
                // Positive Slope
                if((startPoint.getX() > endPoint.getX()) &
                     (startPoint.getY() < endPoint.getY())) {
                      System.out.println("Positive");
                      double y = (slope*(currentPoint.getX()-1)+b);
    //                  System.out.println("Y=" + slope*(currentPoint.getX()-1)+b);
                      System.out.println("Y=" + y);
                      currentPoint = new Point((int)currentPoint.getX()-1, (int)roundDouble(y));
                else if((startPoint.getX() < endPoint.getX()) &
                        (startPoint.getY() > endPoint.getY())) {
                    System.out.println("Positive");
                    double y = (slope*(currentPoint.getX()+1)+b);
    //                System.out.println("Y=" + slope*(currentPoint.getX()+1)+b);
                    System.out.println("Y=" + y);
                    currentPoint = new Point((int)currentPoint.getX()+1, (int)roundDouble(y));
                // Negative Slope
                else if((startPoint.getX() < endPoint.getX()) &
                        (startPoint.getY() < endPoint.getY())) {
                    System.out.println("Negative");
                    double y = (slope*(currentPoint.getX()+1)+b);
    //                System.out.println("Y=" + slope*(currentPoint.getX()+1)+b);
                    System.out.println("Y=" + y);
                    currentPoint = new Point((int)currentPoint.getX()+1, (int)roundDouble(y));
                else if((startPoint.getX() > endPoint.getX()) &
                        (startPoint.getY() > endPoint.getY())) {
                    System.out.println("Negative");
                    double y = (slope*(currentPoint.getX()-1)+b);
    //                System.out.println("Y=" + slope*(currentPoint.getX()-1)+b);
                    System.out.println("Y=" + y);
                    currentPoint = new Point((int)currentPoint.getX()-1, (int)roundDouble(y));
                // Horizontal Line
                else if((startPoint.getX() < endPoint.getX()) &
                        (startPoint.getY() == endPoint.getY())) {
                    System.out.println("Zero");
                    double y = currentPoint.getY();
    //                System.out.println("Y=" + slope*(currentPoint.getX()+1)+b);
                    System.out.println("Y=" + y);
                    currentPoint = new Point((int)currentPoint.getX()+1, (int)roundDouble(y));
                else if((startPoint.getX() > endPoint.getX()) &
                        (startPoint.getY() == endPoint.getY())) {
                    System.out.println("Zero");
                    double y = currentPoint.getY();
    //                System.out.println("Y=" + slope*(currentPoint.getX()-1)+b);
                    System.out.println("Y=" + y);
                    currentPoint = new Point((int)currentPoint.getX()-1, (int)roundDouble(y));
                // Vertical Line
                else if(deltaX == 0 &&
                        (startPoint.getX() == endPoint.getX() &
                         startPoint.getY() < endPoint.getY()) ) {
                    double y = currentPoint.getY()+1;
                    System.out.println("Undefinded");
                    System.out.println("Y=" + y);
                    currentPoint = new Point((int)currentPoint.getX(), (int)roundDouble(y));
                else if(deltaX == 0 &&
                        (startPoint.getX() == endPoint.getX() &
                         startPoint.getY() > endPoint.getY()) ) {
                    int y = (int)currentPoint.getY()-1;
                    System.out.println("Undefinded");
                    System.out.println("Y=" + y);
                    currentPoint = new Point((int)currentPoint.getX(), (int)roundDouble(y));
                linePoints.addElement(currentPoint);
            for(int i = 0; i < linePoints.size(); i++) {
                System.out.println("Point @ " + i + " X: " + ((Point2D)linePoints.elementAt(i)).getX() +
                                   " Y: " + ((Point2D)linePoints.elementAt(i)).getY() + "\n");
            return linePoints;
        }I was wondering if anyone had any insight on this or had already done something similar.

    I was previously replying in the Algorithms forum, so I
    didn't see this discussion. (I don't know why the thread
    was in two forums; isn't it supposed to be better to
    post a link to the other identical thread?)
    I have a strong belief that one end of any perpendicular
    diameter is a vertex of a polygon. If it joins interior
    points of its two end polygon sides, then moving it a
    little parallel to itself will give the same length if both
    of these sides are parallel, otherwise the length will
    increase or decrease depending on the direction. This
    can only change at an end point.
    A slight twist occurs if moving the line in one direction
    causes it to intersect the polygon at more than two points.
    But the point of intersection is necessarily a vertex, or
    possibly more than one vertex simultaneously. QED.
    I was slightly wrong in an earlier reply. I stated that
    it's possible for all intersecting lines to meet the
    polygon in more than two points. My example was the outline
    of a spiral drawn with a thick pen. However, in this case
    there are very short diameters that intesect at just two
    points.

  • Any example for user-defined fuction

    Hi all,
    i need to write user defined fuction , i am very much confused with container and ll this stuffs , pleasse send me example with coding explanation
    thanking you
    sridhar

    Hi,
    How to check JDBC SQL Query Syntax and verify the query results inside a User Defined Function of the Lookup API -
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
      Re: Advanced User Defined Functions - Handling Contexts  
    Posted: Aug 31, 2006 7:45 AM    in response to: Kausik M       Reply      E-mail this post 
    Hi,
    This blog talks about context handling
    /people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping
    This is will give you a clear idea and will be hwlpful for sure
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9202d890-0201-0010-1588-adb5e89a6638
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/190eb190-0201-0010-0ab3-e69f70b6c257
    Advanced User Defined Functions - Handling Contexts
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/190eb190-0201-0010-0ab3-e69f70b6c257
    http://help.sap.com/saphelp_nw04/helpdata/en/40/7b8e40496f6f1de10000000a1550b0/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/22/e127f28b572243b4324879c6bf05a0/frameset.htm
    Regards
    Chilla
    <i>reward points ..</i>

  • Polygon contains()

    Hello :)
    Question about Polygon method contains!
    I have following polygon:
    int[] x = { 10, 100, 100, 10 };
    int[] y = { 10, 10, 100, 100 };
    Polygon polygon = new Polygon(x, y, 4);and following points:
    Point p1 = new Point(10, 45);
    Point p2 = new Point(45, 10);
    Point p3 = new Point(100, 45);
    Point p4 = new Point(45, 100);executing method contains points p1, p2 are inside polygon! But points p3, p4 are not! Why? IMHO p3 and p4 also have to be inside polygon?

    Roberts_V wrote:
    ... Why? IMHO p3 and p4 also have to be inside polygon?From the Polygon.contains(...) docs:
    Determines if the specified coordinates are inside this Polygon. For the definition of insideness, see the class comments of Shape.
    From the Shape docs:
    Definition of insideness: A point is considered to lie inside a Shape if and only if:
    - it lies completely inside the Shape boundary or
    - it lies exactly on the Shape boundary and the space immediately adjacent to the point in the increasing X direction is entirely inside the boundary or
    - it lies exactly on a horizontal boundary segment and the space immediately adjacent to the point in the increasing Y direction is inside the boundary.
    The contains and intersects methods consider the interior of a Shape to be the area it encloses as if it were filled. This means that these methods
    consider unclosed shapes to be implicitly closed for the purpose of determining if a shape contains or intersects a rectangle or if a shape contains
    a point.

  • Poin-in-polygon-operation

    Hallo i am quite new to Oracle Spatial.I am trying to select polygons from a large polygon data set stored in an Oracle Database using known coordinates.To be more specific i want to select a polygon by just knowing a pair of coordinates that reside inside this polygon.How can i manage this??I think this is the so called point-in-polygon-operation, but how can it be applied using Oracle Spatial's functions or operators??What should the spatial query be like in order to use x,y as input parameters for the retrieval of the polygon that this point belongs to??
    Thank you!
    Regards!
    Manousos
    Athens

    Hi Manousos,
    Assumptions:
    You have loaded your polygon data into Oracle.
    You have made an entry in user_sdo_geom_metadata for it.
    You have created a spatial index.
    Your data has a coordinate system of WGS84 (8307)
    If the polygon table name is my_polygons, and the geometry column name is geom, and you want to return col1 and col2 from the my_polygons table:
    SELECT col1, col2
    FROM my_polygons
    WHERE SDO_RELATE (GEOM, MDSYS.SDO_GEOMETRY(2001, 8307, MDSYS.SDO_POINT_TYPE(22,40,null),null,null),
    'mask=anyinteract querytype=WINDOW') = 'TRUE';
    hope this helps.

  • How to fill overlapping areas in a polygon?

    I am creating a polygon animation from lotus shapes. The lotus shapes are crossing each other in circles, so sometimes the resulting polygon is overlapping itself. This causes the overlapped areas to not get painted at all. Look at this screenshot of the polygon to see what I mean:
    http://www.astralvisuals.com/polyLotus.jpg
    Here you can see that there are small black areas, where the lotus shapes intersect. It should be blue instead here. What can I do to get these overlapping areas painted?
    It says on the fillPolygon description:
    "The area inside the polygon is defined using an even-odd fill rule". Is it this rule that causes the overlapping areas to not get painted?

    fillColor works the same for paths or for text,
    to get to the text fillColor property use
    textRef.textRange.characterAttributes.fillColor
    Creating and applying a gradient, from the Scripting Reference, page 63
    // Creates a new gradient in current document then
    // applies the gradient to the frontmost path item
    if ( app.documents.length > 0 ) {
    // Create a color for both ends of the gradient
    var startColor = new RGBColor();
    var endColor = new RGBColor();
    startColor.red = 0;
    startColor.green = 100;
    startColor.blue = 255;
    endColor.red = 220;
    endColor.green = 0;
    endColor.blue = 100;
    // Create a new gradient
    // A new gradient always has 2 stops
    var newGradient = app.activeDocument.gradients.add();
    newGradient.name = "NewGradient";
    newGradient.type = GradientType.LINEAR;
    // Modify the first gradient stop
    newGradient.gradientStops[0].rampPoint = 30;
    newGradient.gradientStops[0].midPoint = 60;
    newGradient.gradientStops[0].color = startColor;
    // Modify the last gradient stop
    newGradient.gradientStops[1].rampPoint = 80;
    newGradient.gradientStops[1].color = endColor;
    // construct an Illustrator.GradientColor object referring to the
    // newly created gradient
    var colorOfGradient = new GradientColor();
    colorOfGradient.gradient = newGradient;
    // get first path item, apply new gradient as its fill
    var topPath = app.activeDocument.pathItems[0];
    topPath.filled = true;
    topPath.fillColor = colorOfGradient;

  • Multiple h:forms inside one f:view not working.

    Hi,
    Iam using myfaces 1.1.5 with tomahawk components.
    Iam having t:panelTabbedPane under one f:view tag.
    Inside t:panelTabbedPane, iam using four t:panelTab's.
    For every t:panelTab, if i have one h:form, the page is displayed but the commandLink's are not working.
    if i have only one h:form for all the tabs its working. why?
    I want h:form for every tab.
    help me,.

    As long as you don't nest forms, it should indeed work.

  • Scenario: MATMAS request inside BPM

    HI,
    we are using the following scenario: BOMMAT IDOC -> XI BPM -> lot of MATMAS IDOCs.
    I have to check a materialnumber in the SAP R/3 Applikation System(Sender) for a special Item inside the BPM.
    Exampel:
    The BOMMAT IDoc is filled with materialnumber 119911. Now i have to get (either outside or inside the BPM) maybe via RFC ? special information about this item from the R/3 sender system (not XI). With this information i can go ahead inside the BPM transformation.
    Any ideas/scenarious ?

    HI,
    You can go for either RFC Lookups where you will be sending a MATMAS request to R3 system and it will response the details from R3 system or you can go for the scenario like IDOC-> RFC request and RFC response-> IDOC
    For Lookup refer the below weblogs and help :
    Lookup - /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    DB lookup - /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    SOAP Lookup - /people/bhavesh.kantilal/blog/2006/11/20/webservice-calls-from-a-user-defined-function
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/406642ea59c753e10000000a1550b0
    Lookup’s in XI made simpler - /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    How to check JDBC SQL Query Syntax and verify the query results inside a User Defined Function of the Lookup API -
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    /people/prasad.illapani/blog/2006/10/25/how-to-check-jdbc-sql-query-syntax-and-verify-the-query-results-inside-a-user-defined-function-of-the-lookup-api
    Lookups - /people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes
    Lookups - /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/406642ea59c753e10000000a1550b0/content.htm
    /people/sap.user72/blog/2005/12/06/optimizing-lookups-in-xi
    Lookups with XSLT - https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8e7daa90-0201-0010-9499-cd347ffbbf72
    /people/sravya.talanki2/blog
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14
    How we have to create the lookups?
    Check this weblogs with some screenshots on how to achieve this:
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    /people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
    /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    /people/sap.user72/blog/2005/12/06/optimizing-lookups-in-xi
    /people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes
    For RFC scenario using BPM refer below weblog:
    /people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit
    thnx
    Chirag

  • Cannot create user defined report

    Guys,
    For an unknown reason, I'm unable to create new reports in some subfolder inside the "User defined report". When I rigth-click on the subfolder, the contextual menu contains only "Copy" and "Paste". But If I'm going to the root folder (User defined report), I'm able to create a new subfolder and new report. I'm even able to create an new report in the subfolder.
    Did you already encounter the same issue and how did you solve it ?
    Thanks

    I vaguely remember someone having issues with user defined report operations, the problem there was solved by changing the user language to English by adding
    AddVMOption -Duser.language=ENto the sqldeveloper.conf file normally located in
    SQLDEVELOPER_INSTALL_DIR/sqldeveloper/binIf you are not already running in English try changing this.

  • JButton with new geometry (polygon)

    Hello,
    I need a JButton with a new geometry.
    For example I need a button with a geometry of an polygon with 6 edges like this:
    It's insufficient to assign a bitmap with a six-edge-polygon-image to an standart button with rectangle geometry!
    Any ideas or hints how I can solve this Problem?
    Thanks a lot for your help!
    bye max
    PS:
    Furthermore I search an irc-channel where I can get fast help for some little problems occuring while programming. Do you know such a channel?

    To generalize, if you want to create a component with a non rectangular geometry, you have to override also
    the method :
    public boolean contains(int, int)
    It must return true if the coordinates are inside the polygon and false otherwise.
    Now, if you click outside the polygon no event will be generated and the click will be transfered to the
    component under this one.
    Denis

  • Adding a screenshot via script

    I often have to put a screenshot in photos of computers and tvs and I want to be able to script this somehow. If I set a path, or shape, or points, is there a way to take another image and place it to fit inside those point (so all corners would meet?) Right now I just place the screenshot image on a separate layer and use Distort transform to match the corners of the screen and screenshot.
    Any thoughts?

    Some time ago I stumbled onto something that I’m afraid I don’t quite comprehend in »Geometry.jsx«, but might help you.
    This Script should transform the activeLayer according to a path named »screen« if it has four points – the Script might need some more work …
    // this script attempts to fit the activeLayer into an area defined by a path named »screen«;
    // use it at your own risk;
    #target photoshop
    // from adobe’s terminology.jsx;
    const classChannel = app.charIDToTypeID('Chnl');
    const classRectangle = app.charIDToTypeID('Rctn');
    const enumNone = app.charIDToTypeID('None');
    const eventSet = app.charIDToTypeID('setd');
    const eventTransform = app.charIDToTypeID('Trnf');
    const keySelection = app.charIDToTypeID('fsel');
    const krectangleStr = app.stringIDToTypeID("rectangle");
    const kquadrilateralStr = app.stringIDToTypeID("quadrilateral");
    const keyBottom = app.charIDToTypeID('Btom');
    const keyLeft = app.charIDToTypeID('Left');
    const keyNull = app.charIDToTypeID('null');
    const keyRight = app.charIDToTypeID('Rght');
    const keyTo = app.charIDToTypeID('T   ');
    const keyTop = app.charIDToTypeID('Top ');
    const typeOrdinal = app.charIDToTypeID('Ordn');
    const unitPixels = app.charIDToTypeID('#Pxl');
    // from adobe’s geometry.jsx;
    // =================================== TPoint ===================================
    function TPoint( x, y )
         this.fX = x;
         this.fY = y;
    // TPoint Constants
    const kTPointOrigion = new TPoint( 0, 0 );
    TPoint.kOrigin = kTPointOrigion;
    const kTPointInfinite = new TPoint( Infinity, Infinity );
    TPoint.kInfinite = kTPointInfinite;
    const kTPointClassname = "TPoint";
    TPoint.prototype.className = kTPointClassname;
    // Overloaded math operators
    TPoint.prototype["=="] = function( Src )
         return (this.fX == Src.fX) && (this.fY == Src.fY);
    TPoint.prototype["+"] = function( b )
         return new TPoint( this.fX + b.fX, this.fY + b.fY );
    TPoint.prototype["-"] = function( b, reversed )
         if (typeof(b) == "undefined")          
    // unary minus
              return new TPoint( -this.fX, -this.fY )
         else
              if (reversed)
                   return new TPoint( b.fX - this.fX, by.fY - this.fY );
              else
                   return new TPoint( this.fX - b.fX, this.fY - b.fY);
    // Multiply and divide work with scalars as well as points
    TPoint.prototype["*"] = function( b )
        if (typeof(b) == 'number')
              return new TPoint( this.fX * b, this.fY * b );
         else
              return new TPoint( this.fX * b.fX, this.fY * b.fY );
    TPoint.prototype["/"] = function( b, reversed )
         if (reversed)
              if (typeof(b) == "number")
                   debugger;
    // Can't divide a number by a point
              else
                   return new TPoint( b.fX / this.fX, b.fY / this.fY );
         else
              if (typeof(b) == 'number')
                   return new TPoint( this.fX / b, this.fY / b );
              else
                   return new TPoint( this.fX / b.fX, this.fY / b.fY );
    TPoint.prototype.toString = function()
         return "[" + this.fX.toString() + "," + this.fY.toString() + "]";
    TPoint.prototype.vectorLength = function()
        return Math.sqrt( this.fX * this.fX + this.fY * this.fY );
    var myDocument = app.activeDocument;
    // assumes the activeLayer is the screenshot;
    var theScreenshot = myDocument.activeLayer;
    var screenFound = false;
    // switch units to pixels;
    var originalUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    try {myDocument.pathItems[0].select();
         myDocument.pathItems[0].deselect()}
    catch (e) {};
    myDocument.selection.deselect();
    var thePathList = new Array;
    // verify document has paths;
    if (myDocument.pathItems.length > 0) {
    // create list of possible paths;
         for (var g = 0; g < myDocument.pathItems.length; g++) {
              if (myDocument.pathItems[g].subPathItems.length == 1 && myDocument.pathItems[g].subPathItems[0].pathPoints.length == 4) {
    // if a fitting path is named screen, take it;
                   if (myDocument.pathItems[g].name == "screen") {
                        var aPath = myDocument.pathItems[g];
                        var screenFound = true
                   else {                    
                        thePathList = thePathList.concat(myDocument.pathItems[g].name)
    // alert if no useable path has been found;
    if (screenFound == false) {
         if (thePathList.length == 0) {
              alert ("no four-points-path available")
         else {
    // if only one path is ok, take it;
              if (thePathList.length == 1) {
                   var aPath = myDocument.pathItems.getByName(thePathList[0]);
                   var screenFound = true
    // else offer the selection;
              else {
                   var aPath = selectAPath ();
                   if (aPath.kind == PathKind.NORMALPATH) {
                        screenFound = true;
    // when no path has been found;
    else {
         alert ("The document contains no paths")
    //////////// transformation ////////////
    try {
    //////////// corners ////////////
    // get the horicontal and vertical coordinates in pixels;
    var hor1 = Number(aPath.subPathItems[0].pathPoints[0].anchor[0]);
    var hor2 = Number(aPath.subPathItems[0].pathPoints[1].anchor[0]);
    var hor3 = Number(aPath.subPathItems[0].pathPoints[2].anchor[0]);
    var hor4 = Number(aPath.subPathItems[0].pathPoints[3].anchor[0]);
    var ver1 = Number(aPath.subPathItems[0].pathPoints[0].anchor[1]);
    var ver2 = Number(aPath.subPathItems[0].pathPoints[1].anchor[1]);
    var ver3 = Number(aPath.subPathItems[0].pathPoints[2].anchor[1]);
    var ver4 = Number(aPath.subPathItems[0].pathPoints[3].anchor[1]);
    // order the horicontal and vertical coordinates;
    var horList = [hor1, hor2, hor3, hor4];
    var verList = [ver1, ver2, ver3, ver4];
    horList.sort(sortNumber);
    verList.sort(sortNumber);
    // check the horicontal value;
    var leftPoints = new Array;
    var rightPoints = new Array;
    for (var k=0; k<aPath.subPathItems[0].pathPoints.length; k++) {
         if (aPath.subPathItems[0].pathPoints[k].anchor[0] == horList[0] ||  aPath.subPathItems[0].pathPoints[k].anchor[0] == horList[1]) {
              leftPoints = leftPoints.concat(aPath.subPathItems[0].pathPoints[k].anchor)
         else {
              rightPoints = rightPoints.concat(aPath.subPathItems[0].pathPoints[k].anchor)
    // define the four cornerpoints;
    if (leftPoints[1] <= leftPoints[3]) {
         var aTopLeft = [leftPoints[0], leftPoints[1]]
         var aBottomLeft = [leftPoints[2], leftPoints[3]];
    else {
         var aTopLeft = [leftPoints[2], leftPoints[3]]
         var aBottomLeft = [leftPoints[0], leftPoints[1]];
    if (rightPoints[1] <= rightPoints[3]) {
         var aTopRight = [rightPoints[0], rightPoints[1]]
         var aBottomRight = [rightPoints[2], rightPoints[3]];
    else {
         var aTopRight = [rightPoints[2], rightPoints[3]]
         var aBottomRight = [rightPoints[0], rightPoints[1]];
    //////////// transform to the new corners ////////////
    transformActiveLayer( [new TPoint(aTopLeft[0], aTopLeft[1]), new TPoint(aTopRight[0], aTopRight[1]), new TPoint(aBottomRight[0], aBottomRight[1]), new TPoint(aBottomLeft[0], aBottomLeft[1])]);
    catch (e) {"error"};
    // resets the preferences units;
    app.preferences.rulerUnits = originalUnits;
    //////////// the  functions ////////////
    // the dialog for multiple possible paths;
    function selectAPath () {
         var dlg = new Window('dialog', "Select a path to use for the perspective", [500,300,820,380])          
         dlg.pathSel = dlg.add('dropdownlist', [12,13,306,35], (thePathList));
         dlg.pathSel.selection = dlg.pathSel[0];
         dlg.buildBtn = dlg.add('button', [13,42,158,67], 'OK', {name:'ok'});
         dlg.cancelBtn = dlg.add('button', [168,42,313,67], 'Cancel', {name:'cancel'});
         var myReturn = dlg.show ();
         if (myReturn == true) {
              var aPath = myDocument.pathItems.getByName(dlg.pathSel.selection);
         return aPath
    // sort numbers, found at www.w3schools.com;
    function sortNumber(a,b) {
         return a - b;
    // from adobe’s stacksupport.jsx;
    // Apply a perspective transform to the current layer, with the
    // corner TPoints given in newCorners (starts at top left, in clockwise order)
    // Potential DOM fix
    function transformActiveLayer( newCorners )
         function pxToNumber( px )
              return px.as("px");
         var saveUnits = app.preferences.rulerUnits;
         app.preferences.rulerUnits = Units.PIXELS;
         var i;
         var setArgs = new ActionDescriptor();
         var chanArg = new ActionReference();
         chanArg.putProperty( classChannel, keySelection );
    //     setArgs.putReference( keyNull, chanArg );
         var boundsDesc = new ActionDescriptor();
         var layerBounds = app.activeDocument.activeLayer.bounds;
         boundsDesc.putUnitDouble( keyTop, unitPixels, pxToNumber( layerBounds[1] ) );
         boundsDesc.putUnitDouble( keyLeft, unitPixels, pxToNumber( layerBounds[0] ) );
         boundsDesc.putUnitDouble( keyRight, unitPixels, pxToNumber( layerBounds[2] ) );
         boundsDesc.putUnitDouble( keyBottom, unitPixels, pxToNumber( layerBounds[3] ) );
    //     setArgs.putObject( keyTo, classRectangle, boundsDesc );
    //     executeAction( eventSet, setArgs );
         var result = new ActionDescriptor();
         var args = new ActionDescriptor();
         var quadRect = new ActionList();
         quadRect.putUnitDouble( unitPixels, pxToNumber( layerBounds[0] ) );
    // ActionList put is different from ActionDescriptor put
         quadRect.putUnitDouble( unitPixels, pxToNumber( layerBounds[1] ) );
         quadRect.putUnitDouble( unitPixels, pxToNumber( layerBounds[2] ) );
         quadRect.putUnitDouble( unitPixels, pxToNumber( layerBounds[3] ) );     
         var quadCorners = new ActionList();
         for (i = 0; i < 4; ++i)
              quadCorners.putUnitDouble( unitPixels, newCorners[i].fX );
              quadCorners.putUnitDouble( unitPixels, newCorners[i].fY );
         args.putList( krectangleStr, quadRect );
         args.putList( kquadrilateralStr, quadCorners );
         executeAction( eventTransform, args );     
    // Deselect
         deselArgs = new ActionDescriptor();
         deselRef = new ActionReference();
         deselRef.putProperty( classChannel, keySelection );
         deselArgs.putReference( keyNull, deselRef );
         deselArgs.putEnumerated( keyTo, typeOrdinal, enumNone );
         executeAction( eventSet, deselArgs );
         app.preferences.rulerUnits = saveUnits;

  • Payment terms- installment payments

    hello,
       how can i exaclty use installment payment in payments terms, it gives me the below msg.
    Breakdown into installment payments not possible for item 001
    I am trying test retainge for an invoice , so it should brekup the line item depending on the criteria of the installment.
    please let me know,

    Hello
    In case of Instalment payment terms plse follow the procedure mentioned below.
    1.Define the payment term by activiting the instalemnt indicator without specifing any discounts rates etc.
    2.Then go to the Instalment step and fill the columns in the first column as your payment term define above based on your no of instalments
    for example u have 4 instalments give the payment term defined above four times and
    in the second column your instlment number like 1st, 2nd,3rd,4th etc.
    in the third column percentage  in that instment let say 40%,20%,20%,20%.
    In the fourth column you assign the normal payment term.
    Plse note that you can assign separate payment term for each instalment and can get discount accordingly by specifyng the discount rates.
    try this it work.if not plse let me know.Assign points if it is useful.
    with regds
    RAJA

Maybe you are looking for

  • Can I use a userKeyFile/userConfigFile as credentials for a JMX connection?

    All, Using a wlst script I created a userKeyFile and userConfigFile so that I can run weblogic scripts without providing the weblogic password. I'd like to use these for my MBean calls from Java as well but I cannot find documentation on using creds

  • Is there a way to prevent iTunes from updating apps?

    I have recently updated an app that I love to play but the update caused me to lose all my saved data and it's very buggy and crashes all the time. I managed to rescue the old version from the recycle bin and deleted the new version from iTunes and m

  • The material account assignment group is missing in sales Order creation

    Hi Gurus, When creating the sales order the material account assignment group is not copied in the sales order line item.  For eg: when the sales order has 5 line item for one of the line item the material account assignment group is not getting copi

  • Only half the cores/processors being used in bootcamp?

    I have two mac pro computers that are both running bootcamp with Win 7 and both are giving me the same problem. One mac pro was purchased in 2011 and the other is early 2008. When I run Cinibench on both these machines I find that only half the cores

  • My Ipod Keeps Skipping tracks!! HELP!

    my ipod keeps skippping songs when im playing one of my playlists!. it only plays any recently added songs and i have resest it but it doesnt do anything. Is it because i often charge it through the computer????...HELP!!....