Properties.java
Go to the documentation of this file.
00001 package edu.tum.cs.vis.model;
00002 
00003 import java.util.HashMap;
00004 import java.util.Vector;
00005 
00006 import edu.tum.cs.ias.knowrob.prolog.PrologInterface;
00007 
00015 public class Properties {
00016 
00025         public static ItemModel getModelOfItem(String identifier) {
00026                 String path = null;
00027                 try {
00028                         if (!identifier.startsWith("'") || !identifier.endsWith("'")) {
00029                                 identifier = "'" + identifier + "'";
00030                         }
00031                         HashMap<String, Vector<String>> nfo = PrologInterface.executeQuery("get_model_path("+ identifier + ",P)");
00032 
00033                         if (nfo!=null && nfo.get("P") != null && nfo.get("P").size() > 0) {
00034                                 String str = nfo.get("P").get(0);
00035 
00036                                 if (str == null)
00037                                         return null;
00038 
00039                                 if (str.startsWith("'") && str.endsWith("'")) {
00040                                         str = str.substring(1, str.length() - 1);
00041                                 }
00042                                 path = str;
00043 
00044                         }
00045 
00046                 } catch (Exception e) {
00047                         System.err.println("Calling get_model_path for Identifier " + identifier + " failed:");
00048                         e.printStackTrace();
00049                         return null;
00050                 }
00051 
00052                 if (path == null)
00053                         return null;
00054                 return new ItemModel(path);
00055         }
00056 
00065         public static float xDimOfObject(String ObjClassOrIdentifier) {
00066                 ItemModel model = getModelOfItem(ObjClassOrIdentifier);
00067                 if (model == null || model.getParser() == null)
00068                         return -1;
00069                 return model.getParser().getModel().getGroup().getTotalWidth();
00070         }
00071 
00080         public static float yDimOfObject(String ObjClassOrIdentifier) {
00081                 ItemModel model = getModelOfItem(ObjClassOrIdentifier);
00082                 if (model == null || model.getParser() == null)
00083                         return -1;
00084                 return model.getParser().getModel().getGroup().getTotalDepth();
00085         }
00086 
00095         public static float zDimOfObject(String ObjClassOrIdentifier) {
00096                 ItemModel model = getModelOfItem(ObjClassOrIdentifier);
00097                 if (model == null || model.getParser() == null)
00098                         return -1;
00099                 return model.getParser().getModel().getGroup().getTotalHeight();
00100         }
00101 
00102 }


knowrob_cad_parser
Author(s): Stefan Profanter
autogenerated on Mon Oct 6 2014 01:29:56