JavaView® v2.00.008

jv.loader
Class PjImportModel

java.lang.Object
  |
  +--jv.object.PsObject
        |
        +--jv.project.PjProject
              |
              +--jv.loader.PjImportModel
All Implemented Interfaces:
java.lang.Cloneable, PsTimeListenerIf, PsUpdateIf, PvPickListenerIf, java.io.Serializable
Direct Known Subclasses:
PjGeodesic, PjVectorField

public class PjImportModel
extends PjProject

Import geometry models from file or via http connections into JavaView. A tutorial applet on different ways to import models in JavaView is found in vgp.tutor.model.PjModel.

Version:
17.04.00, 2.00 revised (kp) Handle array of geometries.
15.01.00, 1.20 revised (kp) Slight changes in the confirmation handling.
01.08.99, 1.10 revised (kp) Naming of models and model directories changed.
Directories are now lowercase, first char of models is uppercase.
01.08.99, 1.00 created (kp)
Author:
Konrad Polthier
See Also:
PjImportModel_InfoBox, PjModel, Serialized Form

Field Summary
static int CONFIRM_CANCEL
           
static int CONFIRM_CLICKED
           
static int CONFIRM_OK
           
static java.lang.String DIR_LIST
          Name of file containing list of model files in each directory.
static int FULL_INFO_PANEL
           
protected  java.lang.String m_baseDir
          Current base directory for models.
protected  java.lang.String m_category
          Current category for models.
protected  int m_confirm
          State of user confirmation when exiting the model load dialog.
protected  java.lang.String m_defBaseDir
          Default base directory for models.
protected  java.lang.String m_defCategory
          Default category for models.
protected  java.lang.String m_defFileName
          Default model file name of geometry.
protected  java.lang.String m_fileName
          Current model file name of geometry.
protected  java.lang.String m_fullFileName
          Full file name of geometry.
protected  PgGeometry[] m_geomList
          List of geometries.
protected  int m_infoPanelType
          Flag which info panel is used
protected static int m_numModels
           
protected  PjProject m_parentProject
          Project who requested this loader.
static int SMALL_INFO_PANEL
           
 
Fields inherited from class jv.project.PjProject
m_anim, m_bAutoFit, m_display, m_displayList, m_geometry, m_parm, m_rootGeometry
 
Fields inherited from class jv.object.PsObject
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_MATERIAL_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_SELECTED, IS_USED, m_infoPanel, m_name, m_panelList, m_parent, m_tag, m_updateList, NUM_TAGS
 
Constructor Summary
PjImportModel()
          Constructor with default full info panel.
 
Method Summary
 java.lang.String getBaseDir()
           
 java.lang.String getCategory()
           
 int getConfirm()
          Allow world to check whether user has choosen OK or Cancel, when existing the import dialog.
 java.lang.String getFileName()
           
 PsPanel getInfoPanel()
          Overwrite method of PsObject to allow choice of different info panels.
 void init()
          Initialize and reset project, stops the running animation if any.
 boolean load(java.lang.String fullFileName)
          Load geometry model from file or URL and add it as selected geometry to this project.
 void setBase(java.lang.String baseDir)
           
 void setCategory(java.lang.String category)
           
protected  void setConfirm(int choice)
          Set user confirmation state of import dialog, i.e. whether user has pressed OK or CANCEL or clicked in list.
 void setFileName(java.lang.String fullFileName)
           
 void setParentProject(PjProject project)
          Register parent project to which the model will be loaded.
 void setTypeOfInfoPanel(int infoType)
          Set type of info panel.
 void start()
          Load geometry file if file name has been specified.
 
Methods inherited from class jv.project.PjProject
addDisplay, addGeometry, addGeometry, dispose, dragDisplay, dragInitial, dragVertex, fitDisplays, getAnimation, getDisplay, getDisplays, getGeometry, getGeometry, getNumGeometries, getParameter, getViewer, hasAnimation, hasDisplay, isEnabledAutoFit, markVertices, pickDisplay, pickInitial, pickVertex, removeDisplay, removeGeometries, removeGeometry, selectDisplay, selectGeometry, setAnimation, setDisplay, setEnabledAutoFit, setParameter, setTime, setViewer, stop, unmarkVertices
 
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, clearTag, clone, clone, clone, copy, getFather, getInspector, getName, getNumObjects, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, removeInspector, removeUpdateListener, setName, setParent, setTag, toString, update, updatePanels
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jv.anim.PsTimeListenerIf
getName
 
Methods inherited from interface jv.project.PvPickListenerIf
getName
 
Methods inherited from interface jv.object.PsUpdateIf
getFather, getName, setParent, update
 

Field Detail

m_parentProject

protected PjProject m_parentProject
Project who requested this loader.

m_geomList

protected PgGeometry[] m_geomList
List of geometries.

m_numModels

protected static final int m_numModels

FULL_INFO_PANEL

public static int FULL_INFO_PANEL

SMALL_INFO_PANEL

public static int SMALL_INFO_PANEL

m_infoPanelType

protected int m_infoPanelType
Flag which info panel is used

DIR_LIST

public static java.lang.String DIR_LIST
Name of file containing list of model files in each directory.

m_defBaseDir

protected java.lang.String m_defBaseDir
Default base directory for models.

m_baseDir

protected java.lang.String m_baseDir
Current base directory for models.

m_defCategory

protected java.lang.String m_defCategory
Default category for models.

m_category

protected java.lang.String m_category
Current category for models.

m_defFileName

protected java.lang.String m_defFileName
Default model file name of geometry.

m_fileName

protected java.lang.String m_fileName
Current model file name of geometry.

m_fullFileName

protected java.lang.String m_fullFileName
Full file name of geometry.

CONFIRM_OK

public static int CONFIRM_OK

CONFIRM_CANCEL

public static int CONFIRM_CANCEL

CONFIRM_CLICKED

public static int CONFIRM_CLICKED

m_confirm

protected int m_confirm
State of user confirmation when exiting the model load dialog. Status is checked e.g. in PvViewer.
See Also:
PvViewer.showDialog(int)
Constructor Detail

PjImportModel

public PjImportModel()
Constructor with default full info panel.
Method Detail

init

public void init()
Description copied from class: PjProject
Initialize and reset project, stops the running animation if any. Does not reset any registered display nor geometry. They must be reset individually in each subclass.
Overrides:
init in class PjProject

start

public void start()
Load geometry file if file name has been specified. Otherwise do nothing.
Overrides:
start in class PjProject
Following copied from class: jv.project.PjProject
See Also:
PvViewerIf.start(), #isEnabledAutoFit(boolean)

getBaseDir

public java.lang.String getBaseDir()

setBase

public void setBase(java.lang.String baseDir)

getCategory

public java.lang.String getCategory()

setCategory

public void setCategory(java.lang.String category)

getFileName

public java.lang.String getFileName()

setFileName

public void setFileName(java.lang.String fullFileName)

setTypeOfInfoPanel

public void setTypeOfInfoPanel(int infoType)
Set type of info panel. Method must be called before info panel has been created.
Parameters:
infoType - type of info panel, e.g. PjImportModel.FULL_INFO_PANEL

getInfoPanel

public PsPanel getInfoPanel()
Overwrite method of PsObject to allow choice of different info panels.
Overrides:
getInfoPanel in class PsObject

getConfirm

public int getConfirm()
Allow world to check whether user has choosen OK or Cancel, when existing the import dialog. For example, used by other projects to restore backupped geometry if user cancels dialog.

setConfirm

protected void setConfirm(int choice)
Set user confirmation state of import dialog, i.e. whether user has pressed OK or CANCEL or clicked in list. This allows to query this project after user interaction about the result. For example, it allows to backup the current geometry, and restore it when user cancels dialog.

setParentProject

public void setParentProject(PjProject project)
Register parent project to which the model will be loaded. When parent project is registered then a model container will be immediately added to parent project. If user selects a model from file then container model is filled or replaced if model in file has different type.

If user cancels the loading process then the container model is removed from parent project. If user accepts the loaded model then it is selected in the parent project.


load

public boolean load(java.lang.String fullFileName)
Load geometry model from file or URL and add it as selected geometry to this project.

Use getGeometry() to get a reference to the loaded model. Use getConfirm() to check whether user has accepted or cancelled an interactive loading process.

Parameters:
fullFileName - fully specified file name including code base, or URL.
Returns:
true if model has been successfully loaded.

JavaView® v2.00.008

The software JavaView® is copyright protected. All Rights Reserved.