1 16 17 package com.buchuki.ensmer.builtin; 18 19 import com.buchuki.ensmer.*; 20 import com.buchuki.ensmer.object.Backend; 21 import com.buchuki.annotations.*; 22 import java.io.Serializable ; 23 import javax.vecmath.Matrix4f; 24 25 35 @Optimize("Static and StaticIcon can share an AbstractStatic superclass") 36 public class StaticIcon extends Backend { 37 38 41 public StaticIcon() {} 42 43 48 public StaticIcon(Serializable data) { 49 this.filename = (String ) data; 50 } 51 52 57 @Override 58 public Serializable getSerializable() { 59 return filename; 60 } 61 62 67 public String getFilename() { 68 return filename; 69 } 70 71 76 public void setFilename(String filename) { 77 this.filename = filename; 78 fireChangeEvent(); 79 } 80 81 89 public void addStaticToPrevious() { 90 AreaManager man = EnsmerManager.instance().getAreaManager(); 91 int count = 0; 92 Area prev; 93 do { 94 Long prevId = man.getHistoricalAreaID(count); 95 if (prevId == null) { 96 return; } 98 prev = man.getArea(prevId); 99 count++; 100 } while (prev.isReadOnly()); 101 Static obj = new Static(); 102 obj.setFilename(filename); 103 Matrix4f location = SceneGraphUtils.positionInFrontOfUser(prev); 104 prev.newObject(obj, location); 105 for (int i = 0; i < count - 1; i++) { 107 man.previousArea(); 108 } 109 EnsmerManager.instance().getUserManager().getInputManager().systemMode(); 111 EnsmerManager.instance().getSelectionManager().clearSelection(); 112 EnsmerManager.instance().getSelectionManager().toggleSelection(obj.getId()); 113 } 114 115 118 private String filename; 119 } 120 | Popular Tags |