This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Please help me, image as background and have coordinate on it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

Please help me, image as background and have coordinate on it

motress zlting
Ranch Hand

Joined: Jan 10, 2010
Posts: 55
what i need to do is :
1.floor image as background
2.plot the contour on image

but the problem is ....
how to set coordinate in java ? Because im using coordinate to draw the signal strength (green)
i aready have signal data, but it is difficult to draw !
Anyone can help me ?


[Thumbnail for sample.jpg]

Karthik Shiraly
Ranch Hand

Joined: Apr 04, 2009
Posts: 491
    
    5
Do you know the floor plan dimensions in distance units (feet / metres), or the scale factor of the diagram?
motress zlting
Ranch Hand

Joined: Jan 10, 2010
Posts: 55
Karthik Shiraly wrote:Do you know the floor plan dimensions in distance units (feet / metres), or the scale factor of the diagram?


actually i have measure the distance between the access point and the signal strength at distance 12m (green colour), signal is -68dbm
Karthik Shiraly
Ranch Hand

Joined: Apr 04, 2009
Posts: 491
    
    5
Hi,

I understood the question to be: how to decide the values of {x, y, radius} in pixels, so that Graphics2D.draw(Ellipse2D) can be used.

To translate the radius of 12m into pixel units appropriate to the floor plan picture, you need the dimensions of the floor plan or the scale factor of the picture.

As an example calculation:
Assume the floor plan is on A4 paper (8.27" x 11.69") with a scale 1 inch = 10 feet.
It's digitized at 72 dpi.
So the resulting original image will be 8.27x72=596 pixels by 11.69x72=842 pixels, and 72 pixels represents 10 ft.
Say this image is loaded into your app JPanel (assume the layout is resizable).
At current layout, the JPanel is 400 by 300 pixels.
So the image will be scaled down to fit the JPanel, with scaling factors 400/596 for x-axis, and 300/842 for y-axis.
This means, in the JPanel, 10 feet is represented by (72 x 400/596) pixels on x-axis and (72 x 300/842) pixels on y-axis.
So 12 feet will be represented by (12/10 x 72 x 400/596) pixels on x-axis and (12/10 x 72 x 300/842) pixels on y-axis.

All this is possible only if you knew the floor plan dimensions or knew 1 inch=10feet (or x metres). Without that, it's not possible to translate 12m to pixels.
motress zlting
Ranch Hand

Joined: Jan 10, 2010
Posts: 55
Karthik Shiraly wrote:Hi,

I understood the question to be: how to decide the values of {x, y, radius} in pixels, so that Graphics2D.draw(Ellipse2D) can be used.

To translate the radius of 12m into pixel units appropriate to the floor plan picture, you need the dimensions of the floor plan or the scale factor of the picture.

As an example calculation:
Assume the floor plan is on A4 paper (8.27" x 11.69") with a scale 1 inch = 10 feet.
It's digitized at 72 dpi.
So the resulting original image will be 8.27x72=596 pixels by 11.69x72=842 pixels, and 72 pixels represents 10 ft.
Say this image is loaded into your app JPanel (assume the layout is resizable).
At current layout, the JPanel is 400 by 300 pixels.
So the image will be scaled down to fit the JPanel, with scaling factors 400/596 for x-axis, and 300/842 for y-axis.
This means, in the JPanel, 10 feet is represented by (72 x 400/596) pixels on x-axis and (72 x 300/842) pixels on y-axis.
So 12 feet will be represented by (12/10 x 72 x 400/596) pixels on x-axis and (12/10 x 72 x 300/842) pixels on y-axis.

All this is possible only if you knew the floor plan dimensions or knew 1 inch=10feet (or x metres). Without that, it's not possible to translate 12m to pixels.



Do you know how can i have a layer of coordinate on that image ?
Karthik Shiraly
Ranch Hand

Joined: Apr 04, 2009
Posts: 491
    
    5
Hi,

Sorry, I didn't understand your question about layer of coordinates. Can you try and explain what you're looking for? Are you asking how to overlay the circle on top of the floor plan so that the floor plan pixels are not overwritten?
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

This is a cross post to http://www.coderanch.com/t/491417/Java-General/java/plot-this-contour

Admins please note.


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38075
    
  22
salvin francis wrote: . . . Admins please note.
Done.

Hope you don't mind, Robert, Rob and Jesper
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please help me, image as background and have coordinate on it
 
Similar Threads
Glass panes -- transparent panes
How can i have a picture as a background and have coordinate on that picture using Java ?
AffineTransform - please help me out
DrawImage Question
Isometric assistance needed