如何在java中刷新3d视图? 家具的专用主页调整家具的主页评估(家具的主页){ //搜索地板上的另一件物品是否包含给定物品,以将其提升到其高度 如果(!piece.isdoorrWindow() &&piece.getElevation()==0){ float[]piecePoints=piece.getPoints(); 家具最高环绕件的HomePieceOfFurniture highestSurroundingPiece=null; 浮动高度=浮动最小值; 对于(家具主页:this.home.getFurniture()){ 如果(本垒打)=本垒打 &&!homePiece.isDoorWindow() &&ISPieceOffurniTunes可在所选级别(本垒打)){ Shape=getPath(homepoice.getPoints()); boolean surroundingPieceContainsPiece=true; 对于(浮动[]点:分段点){ 如果(!shape.contains(点[0],点[1])){ 环绕件CONTAINSPICE=false; 打破 } } if(环绕件包含零件){ 浮动高度=homePiece.getElevation()+homePiece.getHeight(); //普拉文 如果(标高>高度){ 试一试{ 家具表的主页=主页; 家具新件的主页件=件; if(table.getName()包含(“可”)) { if(newpiece.isunfolded()| | newpiece.isfolded()) { FurnitureCatalog1=首选项。getFurnitureCatalog(); FurnitureCategority1=catalog1.getCategories().get(0); CatalogPieceOfFurniture piece2=类别1.getFurniture().get(6); HomePieceOfFurniture piece3=创建HomePieceOfFurniture(piece2); float h=(float)piece3.getHeight(); float w=(float)piece3.getWidth(); float d=(float)piece3.getDepth(); 最终高度=h; 最终宽度=w; 最终深度=d; Content newModel=piece3.getModel(); String name=piece3.getName(); Content-icon=piece3.getIcon(); String id=piece3.getCatalogId(); newpiece.setModel(newModel); newpiece.setName(name); newpiece.setIcon(图标); //newpiece.setId(id); 新件。设置高度(最终高度); newpiece.setWidth(最终宽度); newpiece.setDepth(FinalDepth); newpiece.setFolded(真); 纽件。未展开(假); twoDView.setBackground(Color.decode(ConstantColorsFonts.ButtonNotClicked)); } } if(table.getName()包含(“anger”)) { if(newpiece.isfolded()| | newpiece.isunfolded()) { FurnitureCatalog1=首选项。getFurnitureCatalog(); //List m1=this.home.getFurniture(); FurnitureCategority1=catalog1.getCategories().get(0); CatalogPieceOfFurniture piece2=类别1.getFurniture().get(4); HomePieceOfFurniture piece3=创建HomePieceOfFurniture(piece2); float h=(float)piece3.getHeight(); float w=(float)piece3.getWidth(); float d=(float)piece3.getDepth(); float e=(float)piece3.getElevation(); 最终高度=h; 最终宽度=w; 最终深度=d; Content newModel=piece3.getModel(); String name=piece3.getName(); Content-icon=piece3.getIcon(); String id=piece3.getCatalogId(); newpiece.setModel(newModel); newpiece.setName(name); newpiece.setIcon(图标); 新件。设置高度(最终高度); newpiece.setWidth(最终宽度); newpiece.setDepth(FinalDepth); 标高=标高最终高度; 纽件。设置折叠(假); newpiece.setunfold(真); 新主页面(); } } 如果(最终高度!=0&&FinalDepth!=0&&FinalWidth!=0) { 新件。设置高度(最终高度); newpiece.setWidth(最终宽度); newpiece.setDepth(FinalDepth); } } 捕获(例外情况除外) { JFrame j10=新JFrame(“捕捉”); j10.设置可见(真); j10.设定尺寸(200200); JLabel op5=新的JLabel(“异常”+ex.toString()); j10.添加(op5); } 高度=标高; 最高环绕件=主件; } } } } if(最高环绕件!=null){ 工件设置标高(高度); 返回最高环绕件; } }

如何在java中刷新3d视图? 家具的专用主页调整家具的主页评估(家具的主页){ //搜索地板上的另一件物品是否包含给定物品,以将其提升到其高度 如果(!piece.isdoorrWindow() &&piece.getElevation()==0){ float[]piecePoints=piece.getPoints(); 家具最高环绕件的HomePieceOfFurniture highestSurroundingPiece=null; 浮动高度=浮动最小值; 对于(家具主页:this.home.getFurniture()){ 如果(本垒打)=本垒打 &&!homePiece.isDoorWindow() &&ISPieceOffurniTunes可在所选级别(本垒打)){ Shape=getPath(homepoice.getPoints()); boolean surroundingPieceContainsPiece=true; 对于(浮动[]点:分段点){ 如果(!shape.contains(点[0],点[1])){ 环绕件CONTAINSPICE=false; 打破 } } if(环绕件包含零件){ 浮动高度=homePiece.getElevation()+homePiece.getHeight(); //普拉文 如果(标高>高度){ 试一试{ 家具表的主页=主页; 家具新件的主页件=件; if(table.getName()包含(“可”)) { if(newpiece.isunfolded()| | newpiece.isfolded()) { FurnitureCatalog1=首选项。getFurnitureCatalog(); FurnitureCategority1=catalog1.getCategories().get(0); CatalogPieceOfFurniture piece2=类别1.getFurniture().get(6); HomePieceOfFurniture piece3=创建HomePieceOfFurniture(piece2); float h=(float)piece3.getHeight(); float w=(float)piece3.getWidth(); float d=(float)piece3.getDepth(); 最终高度=h; 最终宽度=w; 最终深度=d; Content newModel=piece3.getModel(); String name=piece3.getName(); Content-icon=piece3.getIcon(); String id=piece3.getCatalogId(); newpiece.setModel(newModel); newpiece.setName(name); newpiece.setIcon(图标); //newpiece.setId(id); 新件。设置高度(最终高度); newpiece.setWidth(最终宽度); newpiece.setDepth(FinalDepth); newpiece.setFolded(真); 纽件。未展开(假); twoDView.setBackground(Color.decode(ConstantColorsFonts.ButtonNotClicked)); } } if(table.getName()包含(“anger”)) { if(newpiece.isfolded()| | newpiece.isunfolded()) { FurnitureCatalog1=首选项。getFurnitureCatalog(); //List m1=this.home.getFurniture(); FurnitureCategority1=catalog1.getCategories().get(0); CatalogPieceOfFurniture piece2=类别1.getFurniture().get(4); HomePieceOfFurniture piece3=创建HomePieceOfFurniture(piece2); float h=(float)piece3.getHeight(); float w=(float)piece3.getWidth(); float d=(float)piece3.getDepth(); float e=(float)piece3.getElevation(); 最终高度=h; 最终宽度=w; 最终深度=d; Content newModel=piece3.getModel(); String name=piece3.getName(); Content-icon=piece3.getIcon(); String id=piece3.getCatalogId(); newpiece.setModel(newModel); newpiece.setName(name); newpiece.setIcon(图标); 新件。设置高度(最终高度); newpiece.setWidth(最终宽度); newpiece.setDepth(FinalDepth); 标高=标高最终高度; 纽件。设置折叠(假); newpiece.setunfold(真); 新主页面(); } } 如果(最终高度!=0&&FinalDepth!=0&&FinalWidth!=0) { 新件。设置高度(最终高度); newpiece.setWidth(最终宽度); newpiece.setDepth(FinalDepth); } } 捕获(例外情况除外) { JFrame j10=新JFrame(“捕捉”); j10.设置可见(真); j10.设定尺寸(200200); JLabel op5=新的JLabel(“异常”+ex.toString()); j10.添加(op5); } 高度=标高; 最高环绕件=主件; } } } } if(最高环绕件!=null){ 工件设置标高(高度); 返回最高环绕件; } },java,swing,applet,Java,Swing,Applet,这是我的代码,工作正常…但在三维视图中引用时出现问题…请帮助我解决问题(三维视图中的模型没有改变!!)代码太多了!也许你应该尝试隔离相关部分…这似乎缺失,请告诉我如何引用三维视图??是否有预定义的方法??? private HomePieceOfFurniture adjustPieceOfFurnitureElevation(HomePieceOfFurniture piece) { // Search if another piece at floor level contains th

这是我的代码,工作正常…但在三维视图中引用时出现问题…请帮助我解决问题(三维视图中的模型没有改变!!)

代码太多了!也许你应该尝试隔离相关部分…这似乎缺失,请告诉我如何引用三维视图??是否有预定义的方法???
private HomePieceOfFurniture adjustPieceOfFurnitureElevation(HomePieceOfFurniture piece) {

 // Search if another piece at floor level contains the given piece to elevate it at its height
  if (!piece.isDoorOrWindow()
      && piece.getElevation() == 0) {


    float [][] piecePoints = piece.getPoints();
    HomePieceOfFurniture highestSurroundingPiece = null;
    float highestElevation = Float.MIN_VALUE;
    for (HomePieceOfFurniture homePiece : this.home.getFurniture()) {
          if (homePiece != piece 
          && !homePiece.isDoorOrWindow()
          && isPieceOfFurnitureVisibleAtSelectedLevel(homePiece)) {

         Shape shape = getPath(homePiece.getPoints());
             boolean surroundingPieceContainsPiece = true;

             for (float [] point : piecePoints) {

               if (!shape.contains(point [0], point [1])) {
                 surroundingPieceContainsPiece = false;
                 break;
               }
             } 

        if (surroundingPieceContainsPiece) {
          float elevation = homePiece.getElevation() + homePiece.getHeight();

          //pravin
            if (elevation > highestElevation) {

            try{

               HomePieceOfFurniture table=homePiece;

               HomePieceOfFurniture newpiece=piece;

              if(table.getName().contains("able"))
               {
                if(newpiece.isunfolded()|| newpiece.isfolded())
                    {

                               FurnitureCatalog catalog1=preferences.getFurnitureCatalog();
                               FurnitureCategory category1=catalog1.getCategories().get(0);
                               CatalogPieceOfFurniture piece2= category1.getFurniture().get(6);
                               HomePieceOfFurniture piece3=createHomePieceOfFurniture(piece2);

                               float h=(float)piece3.getHeight();
                               float w=(float)piece3.getWidth();
                               float d=(float)piece3.getDepth();

                                  FinalHeight=h;
                                  FinalWidth=w;
                                  FinalDepth=d;

                              Content newModel= piece3.getModel();
                              String name=piece3.getName();
                              Content icon=piece3.getIcon();
                              String id=piece3.getCatalogId();

                              newpiece.setModel(newModel);
                              newpiece.setName(name);
                              newpiece.setIcon(icon);

                             // newpiece.setId(id);

                              newpiece.setHeight(FinalHeight);
                              newpiece.setWidth(FinalWidth);
                              newpiece.setDepth(FinalDepth);
                              newpiece.setFolded(true);
                              newpiece.setunFolded(false);

                    twoDView.setBackground(Color.decode(ConstantColorsFonts.ButtonNotClicked));

                  }

             }

            if (table.getName().contains("anger"))
              {

                if(newpiece.isfolded()|| newpiece.isunfolded())

                    {
                       FurnitureCatalog catalog1=preferences.getFurnitureCatalog();
                        //List<HomePieceOfFurniture> m1 = this.home.getFurniture();
                        FurnitureCategory category1=catalog1.getCategories().get(0);
                        CatalogPieceOfFurniture piece2= category1.getFurniture().get(4);
                        HomePieceOfFurniture piece3=createHomePieceOfFurniture(piece2);

                        float h=(float)piece3.getHeight();
                        float w=(float)piece3.getWidth();
                        float d=(float)piece3.getDepth();
                        float e=(float)piece3.getElevation();

                        FinalHeight=h;
                        FinalWidth=w;
                        FinalDepth=d;

                        Content newModel=piece3.getModel();
                        String name=piece3.getName();
                        Content icon=piece3.getIcon();
                        String id=piece3.getCatalogId();

                        newpiece.setModel(newModel);
                        newpiece.setName(name);
                        newpiece.setIcon(icon);
                        newpiece.setHeight(FinalHeight);
                        newpiece.setWidth(FinalWidth);
                        newpiece.setDepth(FinalDepth);

                         elevation=elevation-FinalHeight;

                         newpiece.setFolded(false);
                         newpiece.setunFolded(true);

                         new HomePane();
                   }

           }

          if(FinalHeight!=0 && FinalDepth!=0 && FinalWidth!=0) 
          {

                            newpiece.setHeight(FinalHeight);
                            newpiece.setWidth(FinalWidth);
                            newpiece.setDepth(FinalDepth);
           }
       } 

          catch(Exception ex)
               {
                     JFrame j10 =new JFrame("catch");
                     j10.setVisible(true);
                     j10.setSize(200,200);
                     JLabel op5= new JLabel(" Exception"+ex.toString());
                     j10.add(op5);

               }


                highestElevation = elevation;
                highestSurroundingPiece = homePiece;

              }

            }

          }

        }

      if (highestSurroundingPiece != null) {
      piece.setElevation(highestElevation);
      return highestSurroundingPiece;

    }

  }