How to get unique index furniture that is displayed in the panel ?

This topic has been viewed 5548 times and has 3 replies
Thread status: Active
Questions about extending features and developing plug-ins [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
trojanrob
Posts: 6
Joined: Wed Apr 17, 2013 1:23 pm
Country: Szczecin, Zachodniopomorskie, Poland

How to get unique index furniture that is displayed in the panel ?

Post by trojanrob »

I need this unique index in HomeFurniturePanel to control attributes added to furniture.

Thanks in advance.
Robert
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: How to get unique index furniture that is displayed in the panel ?

Post by Puybaret »

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
trojanrob
Posts: 6
Joined: Wed Apr 17, 2013 1:23 pm
Country: Szczecin, Zachodniopomorskie, Poland

Re: How to get unique index furniture that is displayed in the panel ?

Post by trojanrob »

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

Code: Select all

  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
trojanrob
Posts: 6
Joined: Wed Apr 17, 2013 1:23 pm
Country: Szczecin, Zachodniopomorskie, Poland

Re: How to get unique index furniture that is displayed in the panel ?

Post by trojanrob »

Problem solved.

Code: Select all

this.home.getFurniture().indexOf(leadSelectedPieceOfFurniture) 
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 1 guest