Print at Dec 20, 2025, 6:17:16 AM View all posts in this thread on one page
Posted by trojanrob at Apr 30, 2013, 8:52:47 PM
How to get unique index furniture that is displayed in the panel ?
I need this unique index in HomeFurniturePanel to control attributes added to furniture.

Thanks in advance.
Robert

Posted by Puybaret at May 1, 2013, 10:12:25 AM
Re: How to get unique index furniture that is displayed in the panel ?
Sorry, but I don't see what you mean by "unique index".
By the way, it would be nice to explain also what is your project.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator

Posted by trojanrob at May 5, 2013, 5:12:42 PM
Re: How to get unique index furniture that is displayed in the panel ?
Sorry, but I don't see what you mean by "unique index".
By the way, it would be nice to explain also what is your project.


Hi,

I want use SH3D to create simple 2D plan, put on it my objects.
Add new atributes to objects.
Set added attributes and export all to my application (BMS for small houses) under android.

It's generally.


No problem to add 2D objects.
No problem to add additional attributes to objects.

I added two attributes :
- Type of function
- Number of nod

When the user changes these two attributes (in HomeFurniturePanel)I have to check whether the combination of these two attributes is unique in entire plan of the house.

When checking objects on the plan, I do not know which object is edited

private boolean isNrNoda(Integer typFunkcji, Integer nrNoda) {
for (PieceOfFurniture piece : this.home.getFurniture()) {
if (piece.getTypFunkcji()!=null) {
if (typFunkcji.equals(piece.getTypFunkcji())) {
if (nrNoda.equals(piece.getNrNoda())) {
JOptionPane.showMessageDialog(null, "In this type of function already is nod nr = "+nrNoda);
return true;
}
}
}
}
return false;
}



Sorry for my english.

best regards
Robert

Posted by trojanrob at May 10, 2013, 2:54:20 PM
Re: How to get unique index furniture that is displayed in the panel ?
Problem solved.


this.home.getFurniture().indexOf(leadSelectedPieceOfFurniture)