Java coordinate system.

I'm trying to code a program that crops a selected rectangle of a given image. The way I thought to do this was first I created an array holing the pixels of the image. Then I would use the size of the selected area to define the size of a second array and then use the origin of the selected area to reference where to start the second array copying the pixels across.
This was based on the assumtion that the coordinate system worked in pixels, that given that the image and program window have been set to 640 X 1200 any given point in a 640 X 1200 array would corresspond to it's equivilent on the screen. Yet when I call the getX() method on the selected area object it returns a double.
why a double?
Edited by: FyodorK on Dec 5, 2008 4:46 AM

Which class are you calling the getX() method on? If the documentation says it returns a double, then it does.
As a side note, Graphics2D (in java.awt) objects can have what is called an affine transform, i.e. rotation, translation, skewing, etc. And that's why the logical coordinate system and the physical coordinate system (pixels on the screen) may be different.
s

Similar Messages

  • Coordinate Systems with Java?

    Hi,
    my Question is, if Java provides an easy realization of creating coordiante systems?
    I need to write a Tool that reads Information from a Database an displays parameters in a coordinate system.
    Is Java a good choice for that?
    Thx
    Naggi

    I don't quite get what you mean by coordinate systems, but I assume Java would be suitable for that sort of stuff.

  • 3D Coordinate System

    Hello everyone,
    I am new to Java 3D and was trying to create a simple 3D Coordinate system that has an x, y, and z axis. Can anyone help me or point me in the right direction regarding this issue? Appreciate the help.
    Moe.

    http://www.cs.brown.edu/exploratories/freeSoftware/catalogs/repositoryComponents.html
    has some coordinate systems available
    alain

  • Implementing a coordinate system

    I am writing a simple 2D game running in full-screen mode at 1024x768px.
    I have to measure some distances in the game and don't want to measure this in pixels; I would like to use, for example, kilometers, miles or nautical miles.
    Is there a way to implement a certain coordinate system so that I could say, e.g., 20px = 1km?
    From my Java standard of knowledge I would write a method calculating the px each time to km, miles or nautical miles - at the end I would still calculate in px, just the output would be in km or m... :(
    Thanks for your help!

    But you usually want stuff like text positioned by world coordinates
    but sized in screen coordinates.Sure, but a simple:AffineTransform t= g2d.getTransform();would've solved that too: use the transform to get the screen coordinates
    from your world coordinates and use the gcopy graphics to do the actual
    text rendering (also see my previous reply).
    What I wound up doing in the project where I did lots of this, was the
    create methods to create fonts, strokes etc.. compensating for the
    scaling, but I wound up wishing I'd done it the other way arround
    and converted the world coordinates myself.I always let the Graphics2D do the scaling, stretching etc. while I keep
    a copy of the original Graphics passed in as a parameter; it works for
    me, but I agree: I can imagine code where the other way around would
    be simpler than my way of doing this sort of stuff. It's just that I hate
    doing those silly matrix multiplications myself ;-)
    kind regards,
    Jos

  • Reverse the coordinate system for scripting

    In the office, we're setting up a workflow using the illustrator coordinate system and coordinates from a database to generate graphics by means of (Java)scripting. On the other hand, we will be processing lots of pdf's, based on the same database-driven coordinates.
    Now, with Illustrator (CS5.1) using a coordinate system with (0,0) on the top-left and pdf's having its zero at the bottom-left, things are getting unnessesarily complex. Is this Adobe's intention or just ill development?
    Already numerous people complained about this coordinate-shift to the 4th quadrant... Why doesn't Adobe respond in a clear and uniform voice? What's up ahead with pdf coordinate system? Anymore surprises coming up?
    see...
    http://forums.adobe.com/message/3859580#3859580?tstart=30%233859580
    http://forums.adobe.com/thread/890507?tstart=30 (solves the negative Y in the visual page / Not in scripting)
    Please Adobe, read these yearsold comments once more and learn from the real world:
    http://forums.adobe.com/thread/637015?tstart=1
    Best regards,
    Bart

    this is a user to user forum, so don't expect any kind of answer from Adobe, the change was intentional and it won't be changed back (it seems). In order to get your objects where you want them, you'll have to do the math yourself...one more thing that might help you get what you need...if your script create new documents, the origin is at bottom left, if your script works on existing documents, the origin is at top left.

  • Black Screen with cursor. Java Desktop System.

    Hello everyone.
    I've installed Solaris 10 05/08 x86 32bit in VMWare Workstation 6.5.
    After I logged in in the system (Java Desktop System, Release 3), I've got only a black screen with cursor, nothing more.
    X server: Xsun server configuration:
    Video Device: VMWare Inc vmware0405
    Video Driver: XF86 VMWARE
    Resolution/Colors: 800x600 65536 colors @75Hz
    Screen size: 17 inch
    Monitor type: MultiFrequency 56Hz (up to 1280x1024 interlaced)
    But the CDE starts normally.
    What's the problem?
    Help, please.
    P.S. Computer with VMWARE Workstation: Asus P4P800SE, P4HT 3.0Gz, 2.0Gb Ram, Ati AIW X800 AGP 256Mb..
    Edited by: xaxaTyH on Oct 9, 2008 7:26 AM
    Edited by: xaxaTyH on Oct 9, 2008 7:45 AM

    Hi
    Have you installed all the Recommended Patchset . If not try to install the patches .
    Regards

  • Where I can find and use "Java Desktop System Management Tools "

    With Solaris 10, you not only get the Java Desktop System desktop environment, but also the Java Desktop System Management Tools and a selection of free and trial Development Tools, which are available for download only.
    I found only an information about JDS release 2
    but today it's release 3 already and it's said it already integrated in JDS
    and above sentence it state that it already come with solaris 10?
    where i can find that , where i can use it
    http://docs.sun.com/app/docs/doc/817-7575/6mmsrpduj?a=view
    this page said how to install but ...where I can find CD/
    regards please help

    Good question. It appears to have been installed with Solaris 11/06, as I have all of the packages listed here:
    http://docs.sun.com/app/docs/doc/817-7575/6mmsrpdus?a=view
    However, it does not appear in the Java Web Console. I tried adding it using the wcadmin command, but haven't managed to get it to run as per the docs. The documentation assumes that it is already installed and visible in the Java Web Console...
    According to this documentation:
    http://docs.sun.com/app/docs/doc/817-1985/6mhm8o5l6?a=view#gdjpi
    An application for the Java Web Console should have a WEB-INF directory and an app.xml file. The apoc packages come with neither, so something is missing.

  • Table in PI JAVA only system & Report development in JAVA only system

    Dear Experts ,
    We are migrating from Dual to Single stack JAVA only PI system.
    In Dual stack system all the message data are stored in ABAP table from which MONI pulls data .
    But in JAVA only system how data is stored ..? and how to access those table ..?
    we need a report to develop which will have these data .
    Interface name
    Date & time of run
    Key Data (if possible would like to see key data from the run, for example po number, material number, part number, idoc number would all be considered key data)
    Pass/Fail flag
    Error Message (only required if the run failed)
    How & where to write code to develop this report ...?
    thanks
    Shakif

    Hi Shakif,
    Look at this link:
    Message details and AuditLog from Java Stack using Custom WebService
    and this link about the Java Data Browser:
    Open SQL Data Browser - Process Integration - SCN Wiki
    Best Regards
    Harald

  • Sun Java enterprise System 2005Q1 installation problems

    I have installed 2005q1 parts in my solaris 5.8 box and had some problems running sussessfully portal server and access manager. So I had to uninstall them again.
    The uninstaller from /var/sadm/prod/entsys/uninstaller did not give me option to un install all components, so I have removed some packegs using pkgrm command.
    Now I am trying to reinstall webserver/directory server/access manager again and now getting the follwoing problems.
    Screen for selecting Type of Configuration
    1. Configure Now - Selectively override defaults or express through
    2. Configure Later - Manually configure following installation
    Select Type of Configuration &#91;1&#93; {"<" goes back, "!" exits} 2
    Ready to Install
    The following components will be installed.
    Product: Java Enterprise System
    Location: /var/sadm/prod/entsys
    Space Required: 110.11 MB
    Sun Java(TM) System Web Server 6.1 SP4 2005Q1
    Sun Java(TM) System Directory Preparation Tool
    Sun Java(TM) System Directory Server 5 2005Q1
    Sun Java(TM) System Access Manager 6 2005Q1
    Identity Management and Policy Services Core
    Access Manager Administration Console
    Common Domain Services for Federation Management
    1. Install
    2. Start Over
    3. Exit Installation
    What would you like to do &#91;1&#93; {"<" goes back, "!" exits}? 1
    Please wait while the installer upgrades and installs shared components...
    Java Enterprise System
    <<<< That is all , after that system doesn't come out to next any more". It just hangs up there."
    Please ,, Please advise what i am missing??????
    Thanks
    Srini parise
    jpsrao&#64;hotmail.com

    it seems that you have not uninstalled the previous entire installation. You can clear all installation manually. first, you need remove all information about your previour installation in "/var/sadm/install/productregistry" file, and then deleted the previous installation directory , now suppose you can reinstall it successfully again, good luck!

  • Problem with transforming coordinate systems

    Hiho,
    i've got a problem with transforming coordinate systems.
    When I'm trying to transform a sdo_geometry object to another coordinate sytem and then back to the old system, the coordinates are not the same.
    Here's an example:
    StartSystem SRID is 8220 (Longitude / Latitude (DHDN))
    TargetSystem SRID is 8307 (Longitude / Latitude (WGS84))
    Original object:
    Polygon: {ExteriorRing: LineString: { (0.0, -90.0) (1.5, 0.0) (0.0, 90.0) (4.5, 0.0) (0.0, -90.0)} }
    Transformed object:
    Polygon: {ExteriorRing: LineString: { (0.0, -5156.620156177403) (85.94366926962347, 0.0) (0.0, 5156.620156177403) (257.8310078088704, 0.0) (0.0, -5156.620156177403)} }
    Transformed back to old system:
    Polygon: {ExteriorRing: LineString: { (0.0, -5156.620156177403) (4924.209525017614, 0.0) (0.0, 5156.620156177403) (14772.628575052844, 0.0) (0.0, -5156.620156177403)} }
    Any ideas what to do?
    Thanks for the help in advance.
    Dirk

    Hi Dirk
    Since the transform you are trying to do is just a datum conversion of lat./long. coordinates, even the first transform yields obvious rubbish. What you have provided here does not illustrate how you submitted your polygon to CS_TRANSFORM.
    Provide the syntax of your construction of the corresponding SDO_GEOMETRY object and your SQL select statement that gave these results.
    Bruce

  • Java.lang.system and InputStream

    java.lang.system has 3 fields defined:
    static PrintStream err;
    static InputStream in;
    static PrintStream out;
    As InputStream is a abstract class, can it be used to declare a variable? If so, how to instantiate?
    Thanks

    java.lang.system has 3 fields defined:
    static PrintStream err;
    static InputStream in;
    static PrintStream out;
    As InputStream is a abstract class, can it be used to declare a variable? If so, how to instantiate?You cannot create an object from an abstract class; you can create an object from a sub class of
    that abstract class, and that's exactly what that Stystem.in is refering to, an object from a sub
    class of the abstract class InputStream. This sub class still IS-A Inputstream and all you have
    to know that it behaves exacty as an InputStream.
    Think of it this way -- 'birds' by themselves do not exist; sparrows exist and parrots and penguins exist.
    Still you can point to a penguin and say "hey! That's a bird". And so is the object refered to by the
    System.in variable an InputStream.
    kind regards,
    Jos

  • MapViewer and AUTO:42004 coordinate system

    How can I use Oracle MapViewer against an external WMS server using the coordinate system AUTO:42004?
    I have tried it, but the min/max longitude values in the BBOX parameter become wrong.
    - Ingebrigt -

    Ingebrigt
    The AUTO keyword is not supported in the current release.
    From the MV doc Sec D.2.1.14 SRS Parameter
    "The namespace AUTO, for projections that have an arbitrary center of projection, is not supported. "
    Jayant

  • Issue: non-root access to Java Desktop System

    Hello,
    Rookie here. i have been using Solaris 10 with no problem and accessing the GUI thru the Java Desktop system with no problem. i created a new non-root user 'user1' on the system with all default parameters assigned to the user when doing 'useradd user1'. these default parameters assume a default home directory is assigned to the user, correct? i am able to access the system with 'user1' via console and remote, but i cannot access the GUI thru the Java Desktop system with this user. It accepts my credentials then it flashes a couple of times and sends me back to the welcome log-in screen.
    Are there additional permission that i need to grant this user to access GUI via JDS? i'm able to do everything else as normal. Any help is appreciated.

    doing 'useradd user1'. these default parameters assume a default home directory is assigned to the user, correct? i am Incorrect. man useradd paying attention to -d and -m. Solaris defaults to /export/home and will usually throw an error if you try to use /home as it's controlled by the automounter.
    If it's just a test user account then userdel followed by useradd again.
    alan

  • How can I get the coordinate in the layer coordinate system while doing the iterate?

    I found that the position(x,y) the iterate function tell me is not right sometimes.
    Actually,it happens when the top of the layer is negative. The "y"is in the comp coordinate system(maybe?) but not the layer.In another word, the position with y=0 is not the top.
    More specifically, I have got the color map of a layer. I am able to get the color of any pixel in the layer. But I can't set the color one for one when I use "iterate",because there is an offset.
    Am I supposed to get the offset? Is there any way to access the whole layer directly if I use iterate function?

    so indeed it's the offset at play.
    AE will diminish the buffer at 20% increments, and not for each pixel that
    goes out of sight. it's not really in relation to the upper left corner,
    it's all about what part of your layer buffer is out of sight.
    there's also an "iterate offset function". check it out. perhaps it will
    save you some trouble.
    On Fri, Dec 19, 2014 at 2:45 PM, Hinanawi Tenshi <[email protected]>

  • Select data with SDO_RELATE in lat long coordinate system(8307) in 10gR2

    Hi all,
    I have problem with selecting data from table.
    Data are in lat lon coordinate system 8307.
    These requests don't return any data:
    SELECT ISSUE_ID FROM MAP_ISSUES WHERE SDO_FILTER(GEOMETRY, sdo_geometry (2003, 8307, null, sdo_elem_info_array (1,1003,1),sdo_ordinate_array(-180,-90, 180,-90, 180,90, -180,90, -180,-90)) ) = 'TRUE';
    SELECT ISSUE_ID FROM MAP_ISSUES WHERE SDO_RELATE(GEOMETRY, sdo_geometry (2003, 8307, null, sdo_elem_info_array (1,1003,1),sdo_ordinate_array(-180,-90, 180,-90, 180,90, -180,90, -180,-90)), 'MASK=ANYINTERACT' ) = 'TRUE'
    Optimized polygon does return all data correctly:
    SELECT ISSUE_ID FROM MAP_ISSUES WHERE SDO_FILTER(GEOMETRY, sdo_geometry (2003, 8307, null, sdo_elem_info_array (1,1003,3),sdo_ordinate_array (-180,-90,180,90)) ) = 'TRUE'
    Smaller polygon select data correctly too.
    SELECT ISSUE_ID FROM MAP_ISSUES WHERE SDO_FILTER(GEOMETRY, sdo_geometry (2003, 8307, null, sdo_elem_info_array (1,1003,1),sdo_ordinate_array (52,-7, 54,-7 , 54,-5 , 52,-5, 52,-7)) ) = 'TRUE'
    I have tried changed polygon to be clockwise, counter clockwise, make the area a bit smaller( 160 instead of 180, 89 instead of 90) nothing has helped.
    My explanation than was, that Earth is sphere and each defined polygon defines TWO polygons in the sphere and there is convention that the smaller is chosen to select data. It would make sense along the previous results, but than I found one post which says that this is bug http://www.frontoracle.com/oracle-database/703/180703-size-of-are-of-interest-smaller-equals.html
    I have found in other thread that max only 1/2 of Earth could be selected Different results using SDO_RELATE with polygon and rectangle type but it seems not true, because optimized bounding box works fine!
    What is right? Is there anything in official documentation?
    Is it bug.
    Max 1/2 of Earth could be selected in one request.
    Each polygon defines two areas in the Earth and the smaller one is used to do spatial SDO_RELATE operation?
    Thanks!
    Regards,
    Zdenek

    Zdenek,
    A bug, or limititation, whichever you choose. IMHO if you ask for something, and don't get what you expect, it is a bug that could be fixed.
    But for 10g anywho, the following applies, which is why I choose 120 degree breaks for my code as it is less than 180...
    The following size limits apply with geodetic data:
    ■ No polygon element can have an area larger than one-half the surface of the Earth.
    ■ In a line, the distance between two adjacent coordinates cannot be greater than or
    equal to one-half the perimeter (a great circle) of the Earth.
    If you need to work with larger elements, first break these elements into multiple
    smaller elements and work with them. For example, you cannot create a geometry
    representing the entire ocean surface of the Earth; however, you can create multiple
    geometries, each representing part of the overall ocean surface. To work with a line
    string that is greater than or equal to one-half the perimeter of the Earth, you can add
    one or more intermediate points on the line so that all adjacent coordinates are less
    than one-half the perimeter of the Earth.
    Bryan

Maybe you are looking for