Joined: Dec 26, 2009
Post Count: 13
Status:
Offline
how to get area of room
Hi I saw this topic in earlier too, but our experts answer was get a tape and measure :)
But i really need to get the area of room to call in my plugin. I know there is a method getArea() in Room class, but it got constructor of float [][]. i.e. Room(float[][] points)
I dont know what value should i pass into this, when create Room object before calling getArea()
Room r =new Room(s1); float area=r.getArea();
What i should pass to s1.
Funny thing is, when we draw room, it shows area inside it, but i cant get it to my plugin. :)
France
Joined: Nov 7, 2005
Post Count: 9426
Status:
Offline
Re: how to get area of room
No need to create a new subject. If you're a student and want to become a serious developer, you must learn how to use an API from its documentation or its source code when available. The Javadoc of the Room class says its constructor takes an array of coordinates as parameter, it also proposes methods to modify the coordinates of a room. If you don't know how to interpret the documentation of a method or a constructor, you can take profit of working with an open source program and search in its source code how it's used (for example at line 2033 of the PlanController class). If you don't know how to search in the code, learn Eclipse search menu items, it will save you hours of work.
Finally, from the source code you proposed, I repeat: "since when a line has an area?". In case you didn't get it, this was a clue to help you fix your program.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
Joined: Dec 26, 2009
Post Count: 13
Status:
Offline
Re: how to get area of room
I got ur point, to get a area we need more than 3 points.
But i need to get the area of room which i draw in sweethome3D. I still couldnt get that area. Can you please give a code to get the area of room. Please sir, with out that room area i can't continue my project.
//this result 8.0 always, for all shapes of rooms (this 8 mean half area calculated from given s1), But this is not what i need. I need to get the area of room which i draw in sweethome 3d. If we have to parse values manually, what is the need of having getPoint and getArea method. Please help me in this.
Although i draw 127.16 sized room, this return 16 only. I think when creating a object of room, the value we parse through constructor will effect on getArea method. If so, how can i get that 127.16 (or actual drawn value) Please sir, help me on this.
France
Joined: Nov 7, 2005
Post Count: 9426
Status:
Offline
Re: how to get area of room
You probably didn't request the area of the displayed room. By the way that internal values are always expressed in centimeter.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
Joined: Dec 26, 2009
Post Count: 13
Status:
Offline
Re: how to get area of room
Sir, do i have to use any actionListners to do it, or is there any other class/object that i have to create, before calling getArea. I'm confusing, how that real values, come to method when calling it. I "sout" getPoints using "for" loop, but it returned values which i call when create object of Room (i.e. float s1[][] = { { 0, 0 }, { 0, 4 }, { 4, 4 }, { 4, 0 } };)
So, can you please tell me how can i request the area of the displayed room.
France
Joined: Nov 7, 2005
Post Count: 9426
Status:
Offline
Re: how to get area of room
Sorry, I don't know what you mean by "factory reference class". Even Google wouldn't know!!!
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator