Import Geant4 6.2.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: GNUmakefile,v 1.15 2003/11/17 23:13:01 duns Exp $
|
||||
# $Id: GNUmakefile,v 1.18 2004/06/04 14:17:54 duns Exp $
|
||||
|
||||
name := G4visHepRep
|
||||
|
||||
@@ -6,6 +6,13 @@ ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
GLOBLIBS = libG4vis_management.lib libG4modeling.lib
|
||||
GLOBLIBS += libG4run.lib libG4event.lib
|
||||
GLOBLIBS += libG4tracking.lib libG4processes.lib libG4digits_hits.lib
|
||||
GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
|
||||
GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
|
||||
GLOBLIBS += libG4intercoms.lib libG4global.lib
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
include $(G4INSTALL)/config/G4VIS_BUILD.gmk
|
||||
include $(G4INSTALL)/config/interactivity.gmk
|
||||
@@ -15,15 +22,22 @@ CPPFLAGS += -I$(G4BASE)/visualization/HepRep/include/ref
|
||||
CPPFLAGS += -I$(G4BASE)/visualization/HepRep/include/zipios++
|
||||
CPPFLAGS += -I$(G4BASE)/visualization/HepRep/include/zlib
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/event/include
|
||||
CPPFLAGS += -I$(G4BASE)/track/include
|
||||
CPPFLAGS += -I$(G4BASE)/run/include
|
||||
CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
|
||||
CPPFLAGS += -I$(G4BASE)/particles/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/tracking/include
|
||||
CPPFLAGS += -I$(G4BASE)/visualization/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/visualization/modeling/include
|
||||
CPPFLAGS += -I$(G4BASE)/global/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/global/HEPRandom/include
|
||||
CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
|
||||
CPPFLAGS += -I$(G4BASE)/graphics_reps/include
|
||||
CPPFLAGS += -I$(G4BASE)/intercoms/include
|
||||
CPPFLAGS += -I$(G4BASE)/processes/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/navigation/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/volumes/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.$Id: History,v 1.67 2004/03/15 08:05:37 perl Exp $
|
||||
.$Id: History,v 1.75 2004/06/17 06:50:35 duns Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -19,6 +19,29 @@ committal in the CVS repository !
|
||||
|
||||
History file for visualization/HepRep sub-category
|
||||
--------------------------------------------------
|
||||
17 June 2004 Mark Donszelmann (vis-HepRep-V06-01-05 against geant4-06-02-cand-02)
|
||||
- Fixed GEANT-50:
|
||||
- Renamed zlib prefix from z_ to heprep_z_
|
||||
- Added symbol z_errmsg to list for renaming to avoid conflicts with other
|
||||
programs who contain a copy of zlib (such as Root).
|
||||
|
||||
4 June 2004 Mark Donszelmann (vis-HepRep-V06-01-04 against geant4-06-01-ref-02)
|
||||
- Fixed compilation problem with G4RunManagerKernel
|
||||
|
||||
27 May 2004 Joseph Perl (vis-HepRep-V06-01-02)
|
||||
- Added attributes for Region and Root Region to both HepRep drivers.
|
||||
|
||||
27 May 2004 Mark Donszelmann (vis-HepRep-V06-01-01)
|
||||
- Fixed GEANT17: geometry files can be written separately.
|
||||
- Updated README with instructions
|
||||
see http://bugs.freehep.org/secure/BrowseProject.jspa?id=10041
|
||||
|
||||
26 May 2004 Mark Donszelmann (vis-HepRep-V06-01-00)
|
||||
- Fixed GEANT-47: Added initial viewpoint settings and a command to set the
|
||||
coordinate system.
|
||||
- Fixed GEANT-41: copied new interfaces for HepRep, which uses fewer pointers,
|
||||
see http://bugs.freehep.org/secure/BrowseProject.jspa?id=10041
|
||||
|
||||
14 March 2004 Joseph Perl (vis-HepRep-V06-00-06)
|
||||
- HepRepFile handle duplicate ShowView.
|
||||
- HepRepFile improve layering and hierarchy for hits.
|
||||
|
||||
@@ -93,6 +93,18 @@ To write 10 events (and geometries), use:
|
||||
Be aware that this may increase the size of the output dramatically.
|
||||
|
||||
|
||||
(Optional) You may use the commands:
|
||||
/vis/viewer/zoom to set an initial zoom factor
|
||||
/vis/viewer/set/viewpointThetaPhi to set an initial view point
|
||||
/vis/heprep/setCoordinateSystem uvw to change the coordinate system, where uvw can be "xyz", "zxy", ...
|
||||
|
||||
|
||||
(Optional) You may decide to write .zip files with events and geometry separated (but linked).
|
||||
This results in a smaller zip file, as the geometry is only written once. Use the command:
|
||||
|
||||
/vis/heprep/appendGeometry false
|
||||
|
||||
|
||||
(Optional) To close the file, remove the SceneHandler, use:
|
||||
|
||||
/vis/sceneHandler/remove scene-handler-0
|
||||
@@ -109,5 +121,5 @@ Only one SceneHandler can exist at any time, connected to a single Viewer.
|
||||
Since the HepRep format is a model rather than a view this is not a real
|
||||
limitation. In WIRED you can create as many views (SceneHandlers) as you like.
|
||||
|
||||
4 November 2003
|
||||
27 May 2004
|
||||
Mark.Donszelmann@slac.stanford.edu
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HepRepMessenger.hh,v 1.3 2003/12/11 21:55:54 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4HepRepMessenger.hh,v 1.5 2004/05/27 05:55:19 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//
|
||||
#ifndef G4HepRepMessenger_HH
|
||||
@@ -45,6 +45,7 @@ class G4HepRepMessenger : public G4UImessenger {
|
||||
virtual G4String getEventNumberSuffix();
|
||||
virtual G4bool appendGeometry();
|
||||
virtual G4bool addPointAttributes();
|
||||
virtual G4String getCoordinateSystem();
|
||||
|
||||
|
||||
private:
|
||||
@@ -54,10 +55,13 @@ class G4HepRepMessenger : public G4UImessenger {
|
||||
G4UIcmdWithAString* setEventNumberSuffixCommand;
|
||||
|
||||
G4bool geometry;
|
||||
// G4UIcmdWithABool* appendGeometryCommand;
|
||||
G4UIcmdWithABool* appendGeometryCommand;
|
||||
|
||||
G4bool pointAttributes;
|
||||
G4UIcmdWithABool* addPointAttributesCommand;
|
||||
|
||||
G4String coordinateSystem;
|
||||
G4UIcmdWithAString* setCoordinateSystemCommand;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HepRepSceneHandler.hh,v 1.30 2003/12/11 21:55:55 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4HepRepSceneHandler.hh,v 1.32 2004/05/27 05:55:20 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
|
||||
/**
|
||||
@@ -127,12 +127,16 @@ class G4HepRepSceneHandler: public G4VSceneHandler {
|
||||
void open(G4String name);
|
||||
void close();
|
||||
|
||||
void writeLayers(HEPREP::HepRep* heprep);
|
||||
|
||||
void addAttDefs(HEPREP::HepRepDefinition* definition, const std::map<G4String,G4AttDef>* attDefs);
|
||||
void addAttVals(HEPREP::HepRepAttribute* attribute, const std::map<G4String,G4AttDef>* attDefs, std::vector<G4AttValue>* attValues);
|
||||
|
||||
void addTopLevelAttributes(HEPREP::HepRepType* type);
|
||||
|
||||
// Returns the particular instance/type or if not created, creates them and adds them to the HepRep
|
||||
HEPREP::HepRep* getHepRep();
|
||||
HEPREP::HepRep* getHepRepGeometry();
|
||||
HEPREP::HepRepInstanceTree* getGeometryInstanceTree();
|
||||
HEPREP::HepRepInstance* getGeometryInstance(G4LogicalVolume* volume, int depth);
|
||||
HEPREP::HepRepInstance* getGeometryInstance(G4String volumeName, int depth);
|
||||
@@ -172,6 +176,7 @@ class G4HepRepSceneHandler: public G4VSceneHandler {
|
||||
|
||||
// DO NOT USE member vars directly, use get methods.
|
||||
HEPREP::HepRep* _heprep;
|
||||
HEPREP::HepRep* _heprepGeometry;
|
||||
HEPREP::HepRepInstanceTree* _geometryInstanceTree;
|
||||
std::vector<HEPREP::HepRepInstance*> _geometryInstance;
|
||||
HEPREP::HepRepInstance* _geometryRootInstance;
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HepRepViewer.hh,v 1.16 2003/12/11 21:55:55 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4HepRepViewer.hh,v 1.17 2004/05/27 05:55:20 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
|
||||
/**
|
||||
@@ -37,9 +37,11 @@
|
||||
// Geant4
|
||||
#include "G4VViewer.hh"
|
||||
|
||||
#include "G4HepRepMessenger.hh"
|
||||
|
||||
class G4HepRepViewer: public G4VViewer {
|
||||
public:
|
||||
G4HepRepViewer (G4VSceneHandler& scene, const G4String& name = "");
|
||||
G4HepRepViewer (G4VSceneHandler& scene, G4HepRepMessenger& messenger, const G4String& name = "");
|
||||
virtual ~G4HepRepViewer ();
|
||||
void SetView ();
|
||||
void ClearView ();
|
||||
@@ -47,8 +49,11 @@ class G4HepRepViewer: public G4VViewer {
|
||||
void ShowView ();
|
||||
void FinishView ();
|
||||
|
||||
void reset();
|
||||
|
||||
private:
|
||||
bool geometryIncluded;
|
||||
G4HepRepMessenger& messenger;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
#ifndef HEPREP_HEPREP_H
|
||||
#define HEPREP_HEPREP_H 1
|
||||
|
||||
// Copyright 2000-2003, FreeHEP.
|
||||
// Copyright 2000-2004, FreeHEP.
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -17,14 +18,15 @@
|
||||
#include "HEPREP/HepRepAction.h"
|
||||
#include "HEPREP/HepRepAttDef.h"
|
||||
#include "HEPREP/HepRepAttribute.h"
|
||||
#include "HEPREP/HepRepAttributeListener.h"
|
||||
#include "HEPREP/HepRepAttValue.h"
|
||||
#include "HEPREP/HepRepConstants.h"
|
||||
#include "HEPREP/HepRepDefinition.h"
|
||||
#include "HEPREP/HepRepFactory.h"
|
||||
#include "HEPREP/HepRepFrameListener.h"
|
||||
#include "HEPREP/HepRepInstance.h"
|
||||
#include "HEPREP/HepRepInstanceTree.h"
|
||||
#include "HEPREP/HepRepIterator.h"
|
||||
#include "HEPREP/HepRepIteratorListener.h"
|
||||
#include "HEPREP/HepRepPoint.h"
|
||||
#include "HEPREP/HepRepSelectFilter.h"
|
||||
#include "HEPREP/HepRepTreeID.h"
|
||||
@@ -37,7 +39,6 @@ namespace HEPREP {
|
||||
class HepRepAction;
|
||||
class HepRepInstanceTree;
|
||||
class HepRepSelectFilter;
|
||||
class HepRepType;
|
||||
class HepRepTypeTree;
|
||||
|
||||
/**
|
||||
@@ -61,22 +62,21 @@ public:
|
||||
*
|
||||
* @param layer name of layer to be added to the back of the list.
|
||||
*/
|
||||
virtual bool addLayer(std::string layer) = 0;
|
||||
virtual void addLayer(std::string layer) = 0;
|
||||
|
||||
/**
|
||||
* Returns the list of layers.
|
||||
*
|
||||
* @return the known layer names, in the order back-to-front.
|
||||
*/
|
||||
virtual std::vector<std::string> * getLayerOrder() = 0;
|
||||
virtual std::vector<std::string> getLayerOrder() = 0;
|
||||
|
||||
/**
|
||||
* Add a typetree to this heprep.
|
||||
*
|
||||
* @param typeTree to be added.
|
||||
* @return false only if the tree is written immediately to some stream.
|
||||
*/
|
||||
virtual bool addTypeTree(HepRepTypeTree * typeTree) = 0;
|
||||
virtual void addTypeTree(HepRepTypeTree * typeTree) = 0;
|
||||
|
||||
/**
|
||||
* Remove a typetree from this heprep.
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
*
|
||||
* @return collection of HepRepTypeTrees.
|
||||
*/
|
||||
virtual std::vector<HepRepTypeTree *> * getTypeTrees() = 0;
|
||||
virtual std::set<HepRepTypeTree *> getTypeTrees() = 0;
|
||||
|
||||
/**
|
||||
* Returns a named and versioned typetree.
|
||||
@@ -108,15 +108,13 @@ public:
|
||||
* @param name name of type.
|
||||
* @return named HepRepType.
|
||||
*/
|
||||
virtual HepRepType * getType(std::string name) = 0;
|
||||
|
||||
// HepRepType* getType(String name);
|
||||
/**
|
||||
* Adds an instancetree to this heprep.
|
||||
*
|
||||
* @param instanceTree to be added.
|
||||
* @return false only if the tree is written immediately to some stream.
|
||||
*/
|
||||
virtual bool addInstanceTree(HepRepInstanceTree * instanceTree) = 0;
|
||||
virtual void addInstanceTree(HepRepInstanceTree * instanceTree) = 0;
|
||||
|
||||
/**
|
||||
* Overlays an instancetree to this heprep, overriding attributes and adding children.
|
||||
@@ -137,7 +135,7 @@ public:
|
||||
*
|
||||
* @return collection of HepRepInstanceTrees.
|
||||
*/
|
||||
virtual std::vector<HepRepInstanceTree *> * getInstanceTrees() = 0;
|
||||
virtual std::set<HepRepInstanceTree *> getInstanceTrees() = 0;
|
||||
|
||||
/**
|
||||
* Returns a named and versioned instancetree.
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
// Copyright 2000-2002, FreeHEP.
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -33,9 +34,8 @@ public:
|
||||
* Adds an attValue.
|
||||
*
|
||||
* @param attValue to be added.
|
||||
* @return false only if the value is immediately written to a stream.
|
||||
*/
|
||||
virtual bool addAttValue(HepRepAttValue * attValue) = 0;
|
||||
virtual void addAttValue(HepRepAttValue * attValue) = 0;
|
||||
|
||||
|
||||
/**
|
||||
@@ -47,18 +47,16 @@ public:
|
||||
* @param key name of attValue
|
||||
* @param value value of attValue
|
||||
* @param showLabel show this as label
|
||||
* @return false if an IOException was created.
|
||||
*/
|
||||
virtual bool addAttValue(std::string key, char* value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
|
||||
virtual void addAttValue(std::string key, char* value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
|
||||
/**
|
||||
* Adds an attValue.
|
||||
*
|
||||
* @param key name of attValue
|
||||
* @param value value of attValue
|
||||
* @param showLabel show this as label
|
||||
* @return false only if the value is immediately written to a stream.
|
||||
*/
|
||||
virtual bool addAttValue(std::string key, std::string value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
|
||||
virtual void addAttValue(std::string key, std::string value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
|
||||
|
||||
/**
|
||||
* Adds an attValue.
|
||||
@@ -66,9 +64,8 @@ public:
|
||||
* @param key name of attValue
|
||||
* @param value value of attValue
|
||||
* @param showLabel show this as label
|
||||
* @return false only if the value is immediately written to a stream.
|
||||
*/
|
||||
virtual bool addAttValue(std::string key, int value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
|
||||
virtual void addAttValue(std::string key, int value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
|
||||
|
||||
/**
|
||||
* Adds an attValue.
|
||||
@@ -76,9 +73,8 @@ public:
|
||||
* @param key name of attValue
|
||||
* @param value value of attValue
|
||||
* @param showLabel show this as label
|
||||
* @return false only if the value is immediately written to a stream.
|
||||
*/
|
||||
virtual bool addAttValue(std::string key, double value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
|
||||
virtual void addAttValue(std::string key, double value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
|
||||
|
||||
/**
|
||||
* Adds an attValue.
|
||||
@@ -86,9 +82,8 @@ public:
|
||||
* @param key name of attValue
|
||||
* @param value value of attValue
|
||||
* @param showLabel show this as label
|
||||
* @return false only if the value is immediately written to a stream.
|
||||
*/
|
||||
virtual bool addAttValue(std::string key, bool value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
|
||||
virtual void addAttValue(std::string key, bool value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
|
||||
|
||||
/**
|
||||
* Adds a Color attValue.
|
||||
@@ -96,9 +91,8 @@ public:
|
||||
* @param key name of attValue
|
||||
* @param value value of attValue
|
||||
* @param showLabel show this as label
|
||||
* @return false only if the value is immediately written to a stream.
|
||||
*/
|
||||
virtual bool addAttValue(std::string key, std::vector<double> value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
|
||||
virtual void addAttValue(std::string key, std::vector<double> value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
|
||||
|
||||
/**
|
||||
* Adds a Color attValue.
|
||||
@@ -109,9 +103,8 @@ public:
|
||||
* @param blue color
|
||||
* @param alpha value
|
||||
* @param showLabel show this as label
|
||||
* @return false only if the value is immediately written to a stream.
|
||||
*/
|
||||
virtual bool addAttValue(std::string key, double red, double green, double blue, double alpha = 1.0, int showLabel = HepRepConstants::SHOW_NONE) = 0;
|
||||
virtual void addAttValue(std::string key, double red, double green, double blue, double alpha = 1.0, int showLabel = HepRepConstants::SHOW_NONE) = 0;
|
||||
|
||||
/**
|
||||
* Remove the attvalue named by key.
|
||||
@@ -135,7 +128,7 @@ public:
|
||||
*
|
||||
* @return collection of HepRepAttValues.
|
||||
*/
|
||||
virtual std::vector<HepRepAttValue *> * getAttValuesFromNode() = 0;
|
||||
virtual std::set<HepRepAttValue *> getAttValuesFromNode() = 0;
|
||||
|
||||
/**
|
||||
* Returns a named attribute value from this node.
|
||||
|
||||
+8
-8
@@ -4,10 +4,10 @@
|
||||
// This class was generated by AID - Abstract Interface Definition
|
||||
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
|
||||
// =========================================================================
|
||||
#ifndef HEPREP_HEPREPITERATORLISTENER_H
|
||||
#define HEPREP_HEPREPITERATORLISTENER_H 1
|
||||
#ifndef HEPREP_HEPREPATTRIBUTELISTENER_H
|
||||
#define HEPREP_HEPREPATTRIBUTELISTENER_H 1
|
||||
|
||||
// Copyright 2000-2002, FreeHEP.
|
||||
// Copyright 2000-2004, FreeHEP.
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -15,25 +15,25 @@
|
||||
namespace HEPREP {
|
||||
|
||||
/**
|
||||
* HepRepIteratorListener interface. The implementor is called back for changes
|
||||
* HepRepAttributeListener interface. The implementor is called back for changes
|
||||
* of attributes while using the HepRepIterator to iterate over all the HepRepInstances.
|
||||
*
|
||||
* All names are lowercased.
|
||||
*
|
||||
* @author Mark Donszelmann
|
||||
*/
|
||||
class HepRepIteratorListener {
|
||||
class HepRepAttributeListener {
|
||||
|
||||
public:
|
||||
/// Destructor.
|
||||
virtual ~HepRepIteratorListener() { /* nop */; }
|
||||
virtual ~HepRepAttributeListener() { /* nop */; }
|
||||
|
||||
/**
|
||||
* Called if attribute key changes its value.
|
||||
*
|
||||
* @param key name of the changed attribute.
|
||||
* @param value value of the changed attribute.
|
||||
* @param value value of the changed attribute.
|
||||
* @param lowerCaseValue lower case value of the changed attribute.
|
||||
* @param showLabel value of showLabel.
|
||||
*/
|
||||
virtual void setAttribute(std::string key, std::string value, std::string lowerCaseValue, int showLabel) = 0;
|
||||
@@ -91,4 +91,4 @@ public:
|
||||
virtual void removeAttribute(std::string key) = 0;
|
||||
}; // class
|
||||
} // namespace HEPREP
|
||||
#endif /* ifndef HEPREP_HEPREPITERATORLISTENER_H */
|
||||
#endif /* ifndef HEPREP_HEPREPATTRIBUTELISTENER_H */
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
// Copyright 2000-2002, FreeHEP.
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "HEPREP/HepRepAttribute.h"
|
||||
|
||||
@@ -37,17 +37,15 @@ public:
|
||||
* @param desc description of the definition.
|
||||
* @param category category of the definition.
|
||||
* @param extra extra info of the definition.
|
||||
* @return false only if this definition is written immediately to a stream.
|
||||
*/
|
||||
virtual bool addAttDef(std::string name, std::string desc, std::string category, std::string extra) = 0;
|
||||
virtual void addAttDef(std::string name, std::string desc, std::string category, std::string extra) = 0;
|
||||
|
||||
/**
|
||||
* Adds an attdef.
|
||||
*
|
||||
* @param attDef to be added.
|
||||
* @return false only if this definition is written immediately to a stream.
|
||||
*/
|
||||
virtual bool addAttDef(HepRepAttDef * attDef) = 0;
|
||||
virtual void addAttDef(HepRepAttDef * attDef) = 0;
|
||||
|
||||
/**
|
||||
* Return a named attribute definition searched on this node and any parent nodes.
|
||||
@@ -62,7 +60,7 @@ public:
|
||||
*
|
||||
* @return collection of attributes definitions.
|
||||
*/
|
||||
virtual std::vector<HepRepAttDef *> * getAttDefsFromNode() = 0;
|
||||
virtual std::set<HepRepAttDef *> getAttDefsFromNode() = 0;
|
||||
|
||||
/**
|
||||
* Returns a named attribute definition defined on this node.
|
||||
|
||||
@@ -113,6 +113,14 @@ public:
|
||||
*/
|
||||
virtual HepRepInstanceTree * createHepRepInstanceTree(std::string name, std::string version, HepRepTreeID * typeTree) = 0;
|
||||
|
||||
/**
|
||||
* Creates a HepRepType.
|
||||
*
|
||||
* @param parent to add this type to.
|
||||
* @param name of the type to create.
|
||||
*/
|
||||
virtual HepRepType * createHepRepType(HepRepTypeTree * parent, std::string name) = 0;
|
||||
|
||||
/**
|
||||
* Creates a HepRepType.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// -*- C++ -*-
|
||||
// AID-GENERATED
|
||||
// =========================================================================
|
||||
// This class was generated by AID - Abstract Interface Definition
|
||||
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
|
||||
// =========================================================================
|
||||
#ifndef HEPREP_HEPREPFRAMELISTENER_H
|
||||
#define HEPREP_HEPREPFRAMELISTENER_H 1
|
||||
|
||||
// Copyright 2004, FreeHEP.
|
||||
|
||||
namespace HEPREP {
|
||||
|
||||
/**
|
||||
* HepRepFrameListener interface. The implementor is called back for changes in
|
||||
* drawing in or out of the frame layer.
|
||||
*
|
||||
* @author Mark Donszelmann
|
||||
*/
|
||||
class HepRepFrameListener {
|
||||
|
||||
public:
|
||||
/// Destructor.
|
||||
virtual ~HepRepFrameListener() { /* nop */; }
|
||||
|
||||
/**
|
||||
* Called if we switch from a normal layer to a frame layer, and back.
|
||||
*
|
||||
* @param inFrame true if in a frame layer
|
||||
*/
|
||||
virtual void setFrameLayer(bool inFrame) = 0;
|
||||
}; // class
|
||||
} // namespace HEPREP
|
||||
#endif /* ifndef HEPREP_HEPREPFRAMELISTENER_H */
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef HEPREP_HEPREPINSTANCE_H
|
||||
#define HEPREP_HEPREPINSTANCE_H 1
|
||||
|
||||
// Copyright 2000-2002, FreeHEP.
|
||||
// Copyright 2000-2004, FreeHEP.
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
|
||||
namespace HEPREP {
|
||||
|
||||
class HepRep;
|
||||
class HepRepInstanceTree;
|
||||
class HepRepPoint;
|
||||
class HepRepSelectFilter;
|
||||
class HepRepType;
|
||||
class HepRepTypeTree;
|
||||
|
||||
/**
|
||||
* HepRepInstance interface.
|
||||
@@ -45,9 +45,8 @@ public:
|
||||
* Adds an sub-instance to this instance.
|
||||
*
|
||||
* @param instance sub-instance.
|
||||
* @return false only if written immediately to a stream.
|
||||
*/
|
||||
virtual bool addInstance(HepRepInstance * instance) = 0;
|
||||
virtual void addInstance(HepRepInstance * instance) = 0;
|
||||
|
||||
/**
|
||||
* Removes a sub-instance from this instance.
|
||||
@@ -61,7 +60,7 @@ public:
|
||||
*
|
||||
* @return collection of HepRepInstances.
|
||||
*/
|
||||
virtual std::vector<HepRepInstance *> * getInstances() = 0;
|
||||
virtual std::vector<HepRepInstance *> getInstances() = 0;
|
||||
|
||||
/**
|
||||
* Returns the associated type for this instance.
|
||||
@@ -74,36 +73,56 @@ public:
|
||||
* Adds a point to this instance.
|
||||
*
|
||||
* @param point to be added.
|
||||
* @return false only if written immediately to a stream.
|
||||
*/
|
||||
virtual bool addPoint(HepRepPoint * point) = 0;
|
||||
virtual void addPoint(HepRepPoint * point) = 0;
|
||||
|
||||
/**
|
||||
* Returns a collection of all points this instance keeps.
|
||||
*
|
||||
* @return collection of HepRepPoints.
|
||||
*/
|
||||
virtual std::vector<HepRepPoint *> * getPoints() = 0;
|
||||
virtual std::vector<HepRepPoint *> getPoints() = 0;
|
||||
|
||||
/**
|
||||
* Fills a double[3][n] array with the coordinates of all points, if
|
||||
* none of the points have any attributes defined on them.
|
||||
* The actual number of points filled is returned. In case the number
|
||||
* of points is larger than n, or if any points have attributes, -1 is returned.
|
||||
* One could then call getPoint().
|
||||
*
|
||||
* @see #getPoints()
|
||||
*
|
||||
* @param xyz a double[3][n] array to be filled with points.
|
||||
* @return number of points filled in xyz, or -1 in case of error or non-implementation.
|
||||
*
|
||||
* ONLY in JAVA
|
||||
*/
|
||||
/**
|
||||
* Returns the parent of this instance.
|
||||
*
|
||||
* @return parent of instance, or null if top-level.
|
||||
*/
|
||||
virtual HepRepInstance * getSuperInstance() = 0;
|
||||
|
||||
/**
|
||||
* Returns a deep copy of this instance.
|
||||
*
|
||||
* @param heprep needed to find the associated type.
|
||||
* @param typeTree needed to find the associated type.
|
||||
* @param parent to which the copy is added.
|
||||
* @param filter run on all instances before copying.
|
||||
* @return copy of this instance.
|
||||
*/
|
||||
virtual HepRepInstance * copy(HepRep * heprep, HepRepInstance * parent, HepRepSelectFilter * filter = NULL) = 0;
|
||||
virtual HepRepInstance * copy(HepRepTypeTree * typeTree, HepRepInstance * parent, HepRepSelectFilter * filter = NULL) = 0;
|
||||
|
||||
/**
|
||||
* Returns a deep copy of this instance.
|
||||
*
|
||||
* @param heprep needed to find the associated type.
|
||||
* @param typeTree needed to find the associated type.
|
||||
* @param parent to which the copy is added.
|
||||
* @param filter run on all instances before copying.
|
||||
* @return copy of this instance.
|
||||
*/
|
||||
virtual HepRepInstance * copy(HepRep * heprep, HepRepInstanceTree * parent, HepRepSelectFilter * filter = NULL) = 0;
|
||||
virtual HepRepInstance * copy(HepRepTypeTree * typeTree, HepRepInstanceTree * parent, HepRepSelectFilter * filter = NULL) = 0;
|
||||
}; // class
|
||||
} // namespace HEPREP
|
||||
#endif /* ifndef HEPREP_HEPREPINSTANCE_H */
|
||||
|
||||
@@ -7,18 +7,19 @@
|
||||
#ifndef HEPREP_HEPREPINSTANCETREE_H
|
||||
#define HEPREP_HEPREPINSTANCETREE_H 1
|
||||
|
||||
// Copyright 2000-2002, FreeHEP.
|
||||
// Copyright 2000-2004, FreeHEP.
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "HEPREP/HepRepTreeID.h"
|
||||
|
||||
namespace HEPREP {
|
||||
|
||||
class HepRep;
|
||||
class HepRepInstance;
|
||||
class HepRepSelectFilter;
|
||||
class HepRepTreeID;
|
||||
class HepRepTypeTree;
|
||||
|
||||
/**
|
||||
* HepRepInstanceTree interface.
|
||||
@@ -42,9 +43,8 @@ public:
|
||||
* Adds an instance to this instancetree.
|
||||
*
|
||||
* @param instance to be added.
|
||||
* @return false only if written immediately to a stream.
|
||||
*/
|
||||
virtual bool addInstance(HepRepInstance * instance) = 0;
|
||||
virtual void addInstance(HepRepInstance * instance) = 0;
|
||||
|
||||
/**
|
||||
* Removes an instance from this instancetree.
|
||||
@@ -58,22 +58,21 @@ public:
|
||||
*
|
||||
* @return collection of HepRepInstances.
|
||||
*/
|
||||
virtual std::vector<HepRepInstance *> * getInstances() = 0;
|
||||
virtual std::vector<HepRepInstance *> getInstances() = 0;
|
||||
|
||||
/**
|
||||
* Adds a related instance tree to this instancetree.
|
||||
*
|
||||
* @param instanceTree related instancetree.
|
||||
* @return false only if written immediately to a stream.
|
||||
*/
|
||||
virtual bool addInstanceTree(HepRepTreeID * instanceTree) = 0;
|
||||
virtual void addInstanceTree(HepRepTreeID * instanceTree) = 0;
|
||||
|
||||
/**
|
||||
* Returns a collection of associated instance trees.
|
||||
*
|
||||
* @return collection of HepRepTreeIDs.
|
||||
*/
|
||||
virtual std::vector<HepRepTreeID *> * getInstanceTrees() = 0;
|
||||
virtual std::set<HepRepTreeID *> getInstanceTrees() = 0;
|
||||
|
||||
/**
|
||||
* Returns the associated typetree.
|
||||
@@ -85,13 +84,10 @@ public:
|
||||
/**
|
||||
* Returns a deep copy of this instancetree.
|
||||
*
|
||||
* @param heprep needed to find the associated type.
|
||||
* @param filter to filter the instances.
|
||||
* @return copy of this instancetree.
|
||||
*/
|
||||
virtual HepRepInstanceTree * copy(HepRep * heprep, HepRepSelectFilter * filter = NULL) = 0;
|
||||
|
||||
virtual HepRepTreeID * copy() = 0;
|
||||
virtual HepRepInstanceTree * copy(HepRepTypeTree * typeTree, HepRepSelectFilter * filter = NULL) = 0;
|
||||
}; // class
|
||||
} // namespace HEPREP
|
||||
#endif /* ifndef HEPREP_HEPREPINSTANCETREE_H */
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
#ifndef HEPREP_HEPREPITERATOR_H
|
||||
#define HEPREP_HEPREPITERATOR_H 1
|
||||
|
||||
// Copyright 2000-2002, FreeHEP.
|
||||
// Copyright 2000-2004, FreeHEP.
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace HEPREP {
|
||||
|
||||
class HepRepAttValue;
|
||||
class HepRepAttributeListener;
|
||||
class HepRepFrameListener;
|
||||
class HepRepInstance;
|
||||
class HepRepIteratorListener;
|
||||
|
||||
/**
|
||||
* HepRepIterator interface.
|
||||
@@ -47,22 +47,41 @@ public:
|
||||
*
|
||||
* @param listener to be added.
|
||||
*/
|
||||
virtual bool addHepRepIteratorListener(HepRepIteratorListener * listener) = 0;
|
||||
virtual void addHepRepAttributeListener(std::string name, HepRepAttributeListener * listener) = 0;
|
||||
|
||||
/**
|
||||
* Removes a listener.
|
||||
*
|
||||
* @param listener to be removed.
|
||||
*/
|
||||
virtual void removeHepRepIteratorListener(HepRepIteratorListener * listener) = 0;
|
||||
virtual void removeHepRepAttributeListener(std::string name, HepRepAttributeListener * listener) = 0;
|
||||
|
||||
/**
|
||||
* Adds a listener to be informed about attribute changes while iterating.
|
||||
*
|
||||
* @param listener to be added.
|
||||
*/
|
||||
virtual void addHepRepFrameListener(HepRepFrameListener * listener) = 0;
|
||||
|
||||
/**
|
||||
* Removes a listener.
|
||||
*
|
||||
* @param listener to be removed.
|
||||
*/
|
||||
virtual void removeHepRepFrameListener(HepRepFrameListener * listener) = 0;
|
||||
|
||||
/**
|
||||
* Returns true if the current instance, just delivered by nextInstance(), is to be drawn as a frame.
|
||||
*/
|
||||
virtual bool drawAsFrame() = 0;
|
||||
|
||||
/**
|
||||
* Returns the attValue for key at the current point of iteration.
|
||||
*
|
||||
* @param key name of tye attribute to be looked up.
|
||||
* @param key name of the attribute to be looked up.
|
||||
* @return value associated to name at this point in the iteration.
|
||||
*/
|
||||
virtual HepRepAttValue * getAttValue(std::string key) = 0;
|
||||
// HepRepAttValue* getAttValue(String key);
|
||||
}; // class
|
||||
} // namespace HEPREP
|
||||
#endif /* ifndef HEPREP_HEPREPITERATOR_H */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef HEPREP_HEPREPTREEID_H
|
||||
#define HEPREP_HEPREPTREEID_H 1
|
||||
|
||||
// Copyright 2000-2002, FreeHEP.
|
||||
// Copyright 2000-2003, FreeHEP.
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -56,8 +56,9 @@ public:
|
||||
* Returns a deep copy of this treeID.
|
||||
*
|
||||
* @return copy of this treeID.
|
||||
* @throws CloneNotSupportedException if copying is not possible.
|
||||
*/
|
||||
virtual HepRepTreeID * copy() = 0;
|
||||
// HepRepTreeID* copy() throws CloneNotSupportedException;
|
||||
}; // class
|
||||
} // namespace HEPREP
|
||||
#endif /* ifndef HEPREP_HEPREPTREEID_H */
|
||||
|
||||
@@ -7,17 +7,15 @@
|
||||
#ifndef HEPREP_HEPREPTYPE_H
|
||||
#define HEPREP_HEPREPTYPE_H 1
|
||||
|
||||
// Copyright 2000-2002, FreeHEP.
|
||||
// Copyright 2000-2003, FreeHEP.
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "HEPREP/HepRepDefinition.h"
|
||||
|
||||
namespace HEPREP {
|
||||
|
||||
class HepRep;
|
||||
|
||||
/**
|
||||
* HepRepType interface.
|
||||
*
|
||||
@@ -33,9 +31,8 @@ public:
|
||||
* Adds a sub-type to this type.
|
||||
*
|
||||
* @param type sub-type to be added.
|
||||
* @return false only if written directly to a stream.
|
||||
*/
|
||||
virtual bool addType(HepRepType * type) = 0;
|
||||
virtual void addType(HepRepType * type) = 0;
|
||||
|
||||
/**
|
||||
* Returns the name of this type.
|
||||
@@ -65,6 +62,13 @@ public:
|
||||
*/
|
||||
virtual std::string getDescription() = 0;
|
||||
|
||||
/**
|
||||
* Sets the description of this type.
|
||||
*
|
||||
* @param infoURL
|
||||
*/
|
||||
virtual void setDescription(std::string description) = 0;
|
||||
|
||||
/**
|
||||
* Returns the information URL of this type.
|
||||
*
|
||||
@@ -72,6 +76,13 @@ public:
|
||||
*/
|
||||
virtual std::string getInfoURL() = 0;
|
||||
|
||||
/**
|
||||
* Sets the information URL of this type.
|
||||
*
|
||||
* @param infoURL
|
||||
*/
|
||||
virtual void setInfoURL(std::string infoURL) = 0;
|
||||
|
||||
/**
|
||||
* Returns the parent of this type.
|
||||
*
|
||||
@@ -84,16 +95,15 @@ public:
|
||||
*
|
||||
* @return collection of HepRepTypes.
|
||||
*/
|
||||
virtual std::vector<HepRepType *> * getTypes() = 0;
|
||||
virtual std::set<HepRepType *> getTypes() = 0;
|
||||
|
||||
/**
|
||||
* Returns a deep copy of this type.
|
||||
*
|
||||
* @param heprep top-level heprep. (Not sure if this is necessary).
|
||||
* @param parent to which this copy is added.
|
||||
* @return copy of this type.
|
||||
*/
|
||||
virtual HepRepType * copy(HepRep * heprep, HepRepType * parent) = 0;
|
||||
virtual HepRepType * copy(HepRepType * parent) = 0;
|
||||
}; // class
|
||||
} // namespace HEPREP
|
||||
#endif /* ifndef HEPREP_HEPREPTYPE_H */
|
||||
|
||||
@@ -9,14 +9,13 @@
|
||||
|
||||
// Copyright 2000-2002, FreeHEP.
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include "HEPREP/HepRepTreeID.h"
|
||||
|
||||
namespace HEPREP {
|
||||
|
||||
class HepRep;
|
||||
class HepRepTreeID;
|
||||
class HepRepType;
|
||||
|
||||
/**
|
||||
@@ -34,29 +33,34 @@ public:
|
||||
* Adds a type to this typetree.
|
||||
*
|
||||
* @param type to be added.
|
||||
* @return false only if written immediatelty to a stream.
|
||||
*/
|
||||
virtual bool addType(HepRepType * type) = 0;
|
||||
virtual void addType(HepRepType * type) = 0;
|
||||
|
||||
/**
|
||||
* Returns a collection of all types in this tree.
|
||||
*
|
||||
* @return collection of HepRepTypes.
|
||||
*/
|
||||
virtual std::vector<HepRepType *> * getTypes() = 0;
|
||||
virtual std::set<HepRepType *> getTypes() = 0;
|
||||
|
||||
/**
|
||||
* Returns type
|
||||
*/
|
||||
virtual HepRepType * getType(std::string fullName) = 0;
|
||||
|
||||
/**
|
||||
* Returns a deep copy of this typetree.
|
||||
*
|
||||
* @param heprep top-level heprep. (Not sure if this is necessary).
|
||||
* @return copy of this typetree.
|
||||
*/
|
||||
virtual HepRepTypeTree * copy(HepRep * heprep) = 0;
|
||||
virtual HepRepTypeTree * copy() = 0;
|
||||
|
||||
//
|
||||
// To be enable in g++ 3.0
|
||||
// using HepRep::HepRepTreeID::copy;
|
||||
// To be disabled in g++ 3.0
|
||||
virtual HepRepTreeID * copy() = 0;
|
||||
// HepRepTreeID * copy();
|
||||
//
|
||||
}; // class
|
||||
} // namespace HEPREP
|
||||
#endif /* ifndef HEPREP_HEPREPTYPETREE_H */
|
||||
|
||||
@@ -38,6 +38,15 @@ public:
|
||||
/// Destructor.
|
||||
virtual ~HepRepWriter() { /* nop */; }
|
||||
|
||||
/**
|
||||
* Adds a property, to be written to the HepRep file when closed.
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @return false in case of a stream problem.
|
||||
*/
|
||||
virtual bool addProperty(std::string key, std::string value) = 0;
|
||||
|
||||
/**
|
||||
* Closes the writer and its underlying stream.
|
||||
*
|
||||
@@ -60,7 +69,7 @@ public:
|
||||
* @param layerOrder to be written.
|
||||
* @return false in case of a stream problem.
|
||||
*/
|
||||
virtual bool write(std::vector<std::string> * layerOrder) = 0;
|
||||
virtual bool write(std::vector<std::string> layerOrder) = 0;
|
||||
|
||||
/**
|
||||
* Writes a HepRepTypeTree.
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include "HEPREP/HepRep.h"
|
||||
#include "HEPREP/HepRepSelectFilter.h"
|
||||
@@ -21,22 +22,21 @@ class DefaultHepRep : public virtual HEPREP::HepRep {
|
||||
|
||||
private:
|
||||
std::vector<std::string> layers;
|
||||
std::vector<HEPREP::HepRepTypeTree*> typeTrees;
|
||||
std::vector<HEPREP::HepRepInstanceTree*> instanceTrees;
|
||||
std::set<HEPREP::HepRepTypeTree*> typeTrees;
|
||||
std::set<HEPREP::HepRepInstanceTree*> instanceTrees;
|
||||
|
||||
public:
|
||||
DefaultHepRep();
|
||||
~DefaultHepRep();
|
||||
|
||||
HEPREP::HepRep* copy(HEPREP::HepRepSelectFilter* filter);
|
||||
std::vector<std::string>* getLayerOrder();
|
||||
bool addLayer(std::string layer);
|
||||
bool addTypeTree(HEPREP::HepRepTypeTree* typeTree);
|
||||
std::vector<std::string> getLayerOrder();
|
||||
void addLayer(std::string layer);
|
||||
void addTypeTree(HEPREP::HepRepTypeTree* typeTree);
|
||||
void removeTypeTree(HEPREP::HepRepTypeTree* typeTree);
|
||||
HEPREP::HepRepTypeTree* getTypeTree(std::string name, std::string version);
|
||||
std::vector<HEPREP::HepRepTypeTree*>* getTypeTrees();
|
||||
HEPREP::HepRepType* getType(std::string name);
|
||||
bool addInstanceTree(HEPREP::HepRepInstanceTree* instanceTree);
|
||||
std::set<HEPREP::HepRepTypeTree*> getTypeTrees();
|
||||
void addInstanceTree(HEPREP::HepRepInstanceTree* instanceTree);
|
||||
void overlayInstanceTree(HEPREP::HepRepInstanceTree * instanceTree);
|
||||
void removeInstanceTree(HEPREP::HepRepInstanceTree* instanceTree);
|
||||
HEPREP::HepRepInstanceTree* getInstanceTreeTop(std::string name, std::string version);
|
||||
@@ -52,7 +52,7 @@ class DefaultHepRep : public virtual HEPREP::HepRep {
|
||||
bool getNonDrawAtts,
|
||||
std::vector<std::string> invertAtts);
|
||||
std::string checkForException();
|
||||
std::vector<HEPREP::HepRepInstanceTree*>* getInstanceTrees();
|
||||
std::set<HEPREP::HepRepInstanceTree*> getInstanceTrees();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "HEPREP/HepRepAttribute.h"
|
||||
@@ -20,21 +21,20 @@ class DefaultHepRepAttribute : public virtual HEPREP::HepRepAttribute {
|
||||
|
||||
private:
|
||||
std::map<std::string, HEPREP::HepRepAttValue*> attValues;
|
||||
std::vector<HEPREP::HepRepAttValue*> attList;
|
||||
|
||||
public:
|
||||
DefaultHepRepAttribute();
|
||||
~DefaultHepRepAttribute();
|
||||
|
||||
std::vector<HEPREP::HepRepAttValue*>* getAttValuesFromNode();
|
||||
bool addAttValue(HEPREP::HepRepAttValue* hepRepAttValue);
|
||||
bool addAttValue(std::string key, char *value, int showLabel);
|
||||
bool addAttValue(std::string key, std::string value, int showLabel);
|
||||
bool addAttValue(std::string key, int value, int showLabel);
|
||||
bool addAttValue(std::string key, double value, int showLabel);
|
||||
bool addAttValue(std::string key, bool value, int showLabel);
|
||||
bool addAttValue(std::string key, std::vector<double> value, int showLabel);
|
||||
bool addAttValue(std::string key, double red, double green, double blue, double alpha, int showLabel);
|
||||
std::set<HEPREP::HepRepAttValue*> getAttValuesFromNode();
|
||||
void addAttValue(HEPREP::HepRepAttValue* hepRepAttValue);
|
||||
void addAttValue(std::string key, char *value, int showLabel);
|
||||
void addAttValue(std::string key, std::string value, int showLabel);
|
||||
void addAttValue(std::string key, int value, int showLabel);
|
||||
void addAttValue(std::string key, double value, int showLabel);
|
||||
void addAttValue(std::string key, bool value, int showLabel);
|
||||
void addAttValue(std::string key, std::vector<double> value, int showLabel);
|
||||
void addAttValue(std::string key, double red, double green, double blue, double alpha, int showLabel);
|
||||
HEPREP::HepRepAttValue* getAttValueFromNode(std::string lowerCaseName);
|
||||
HEPREP::HepRepAttValue* removeAttValue(std::string key);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include "HEPREP/HepRepDefinition.h"
|
||||
#include "HEPREP/HepRepWriter.h"
|
||||
@@ -19,15 +20,14 @@ class DefaultHepRepDefinition : public DefaultHepRepAttribute, public virtual HE
|
||||
|
||||
private:
|
||||
std::map<std::string, HEPREP::HepRepAttDef*> attDefs;
|
||||
std::vector<HEPREP::HepRepAttDef*> attList;
|
||||
|
||||
public:
|
||||
DefaultHepRepDefinition();
|
||||
~DefaultHepRepDefinition();
|
||||
|
||||
bool addAttDef(HEPREP::HepRepAttDef* hepRepAttDef);
|
||||
bool addAttDef(std::string name, std::string desc, std::string type, std::string extra);
|
||||
std::vector<HEPREP::HepRepAttDef *>* getAttDefsFromNode();
|
||||
void addAttDef(HEPREP::HepRepAttDef* hepRepAttDef);
|
||||
void addAttDef(std::string name, std::string desc, std::string type, std::string extra);
|
||||
std::set<HEPREP::HepRepAttDef *> getAttDefsFromNode();
|
||||
HEPREP::HepRepAttDef* getAttDefFromNode(std::string lowerCaseName);
|
||||
|
||||
HEPREP::HepRepAttDef* getAttDef(std::string name) = 0;
|
||||
|
||||
@@ -41,6 +41,7 @@ class DefaultHepRepFactory : public virtual HEPREP::HepRepFactory {
|
||||
HEPREP::HepRepInstanceTree* createHepRepInstanceTree (std::string name, std::string version,
|
||||
HEPREP::HepRepTreeID* typeTreeID);
|
||||
HEPREP::HepRepType* createHepRepType (HEPREP::HepRepType* parent, std::string name);
|
||||
HEPREP::HepRepType* createHepRepType (HEPREP::HepRepTypeTree* parent, std::string name);
|
||||
HEPREP::HepRepTypeTree* createHepRepTypeTree (HEPREP::HepRepTreeID* treeID);
|
||||
HEPREP::HepRep* createHepRep ();
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
class DefaultHepRepInstance : public DefaultHepRepAttribute, public virtual HEPREP::HepRepInstance {
|
||||
|
||||
private:
|
||||
void* parent;
|
||||
HEPREP::HepRepInstance* parent;
|
||||
HEPREP::HepRepType* type;
|
||||
std::vector<HEPREP::HepRepPoint*> points;
|
||||
std::vector<HEPREP::HepRepInstance*> instances;
|
||||
@@ -35,14 +35,15 @@ class DefaultHepRepInstance : public DefaultHepRepAttribute, public virtual HEPR
|
||||
~DefaultHepRepInstance();
|
||||
|
||||
void overlay(HEPREP::HepRepInstance * instance);
|
||||
HEPREP::HepRepInstance* copy(HEPREP::HepRep* heprep, HEPREP::HepRepInstance* parent, HEPREP::HepRepSelectFilter* filter);
|
||||
HEPREP::HepRepInstance* copy(HEPREP::HepRep* heprep, HEPREP::HepRepInstanceTree* parent, HEPREP::HepRepSelectFilter* filter);
|
||||
HEPREP::HepRepInstance* copy(HEPREP::HepRepTypeTree* typeTree, HEPREP::HepRepInstance* parent, HEPREP::HepRepSelectFilter* filter);
|
||||
HEPREP::HepRepInstance* copy(HEPREP::HepRepTypeTree* typeTree, HEPREP::HepRepInstanceTree* parent, HEPREP::HepRepSelectFilter* filter);
|
||||
HEPREP::HepRepType* getType();
|
||||
bool addPoint(HEPREP::HepRepPoint* point);
|
||||
std::vector<HEPREP::HepRepPoint *>* getPoints();
|
||||
bool addInstance(HEPREP::HepRepInstance* instance);
|
||||
void addPoint(HEPREP::HepRepPoint* point);
|
||||
std::vector<HEPREP::HepRepPoint *> getPoints();
|
||||
HEPREP::HepRepInstance* getSuperInstance();
|
||||
void addInstance(HEPREP::HepRepInstance* instance);
|
||||
void removeInstance(HEPREP::HepRepInstance* instance);
|
||||
std::vector<HEPREP::HepRepInstance *>* getInstances();
|
||||
std::vector<HEPREP::HepRepInstance *> getInstances();
|
||||
|
||||
HEPREP::HepRepAttValue* getAttValue(std::string name);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include "HEPREP/HepRep.h"
|
||||
#include "HEPREP/HepRepSelectFilter.h"
|
||||
@@ -24,21 +25,20 @@ class DefaultHepRepInstanceTree : public DefaultHepRepTreeID, public virtual HEP
|
||||
private:
|
||||
HEPREP::HepRepTreeID* typeTree;
|
||||
std::vector<HEPREP::HepRepInstance*> instances;
|
||||
std::vector<HEPREP::HepRepTreeID*> instanceTrees;
|
||||
std::set<HEPREP::HepRepTreeID*> instanceTrees;
|
||||
|
||||
public:
|
||||
DefaultHepRepInstanceTree(std::string name, std::string version, HEPREP::HepRepTreeID* typeTree);
|
||||
~DefaultHepRepInstanceTree();
|
||||
|
||||
void overlay(HEPREP::HepRepInstanceTree * instanceTree);
|
||||
HEPREP::HepRepInstanceTree* copy(HEPREP::HepRep* heprep, HEPREP::HepRepSelectFilter* filter);
|
||||
HEPREP::HepRepTreeID* copy();
|
||||
bool addInstance(HEPREP::HepRepInstance* instance);
|
||||
HEPREP::HepRepInstanceTree* copy(HEPREP::HepRepTypeTree* typeTree, HEPREP::HepRepSelectFilter* filter);
|
||||
void addInstance(HEPREP::HepRepInstance* instance);
|
||||
void removeInstance(HEPREP::HepRepInstance* instance);
|
||||
std::vector<HEPREP::HepRepInstance*>* getInstances();
|
||||
bool addInstanceTree(HEPREP::HepRepTreeID* treeID);
|
||||
std::vector<HEPREP::HepRepInstance*> getInstances();
|
||||
void addInstanceTree(HEPREP::HepRepTreeID* treeID);
|
||||
HEPREP::HepRepTreeID* getTypeTree();
|
||||
std::vector<HEPREP::HepRepTreeID*>* getInstanceTrees();
|
||||
std::set<HEPREP::HepRepTreeID*> getInstanceTrees();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,7 +27,6 @@ class DefaultHepRepTreeID : public virtual HEPREP::HepRepTreeID {
|
||||
void setQualifier(std::string qualifier);
|
||||
std::string getName();
|
||||
std::string getVersion();
|
||||
HEPREP::HepRepTreeID* copy();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include "HEPREP/HepRep.h"
|
||||
#include "HEPREP/HepRepType.h"
|
||||
@@ -22,27 +23,28 @@ class DefaultHepRepType : public DefaultHepRepDefinition, public virtual HEPREP:
|
||||
|
||||
private:
|
||||
HEPREP::HepRepType* parent;
|
||||
std::vector<HEPREP::HepRepType*> types;
|
||||
std::set<HEPREP::HepRepType*> types;
|
||||
std::string name;
|
||||
std::string description;
|
||||
std::string infoURL;
|
||||
|
||||
public:
|
||||
DefaultHepRepType(HEPREP::HepRepType* parent, std::string name);
|
||||
DefaultHepRepType(HEPREP::HepRepTypeTree* parent, std::string name);
|
||||
~DefaultHepRepType();
|
||||
|
||||
HEPREP::HepRepType* getSuperType();
|
||||
HEPREP::HepRepAttDef* getAttDef(std::string name);
|
||||
HEPREP::HepRepAttValue* getAttValue(std::string name);
|
||||
HEPREP::HepRepType* copy(HEPREP::HepRep* heprep, HEPREP::HepRepType* parent);
|
||||
HEPREP::HepRepType* copy(HEPREP::HepRepType* parent);
|
||||
std::string getName();
|
||||
std::string getFullName();
|
||||
std::string getDescription();
|
||||
void setDescription(std::string description);
|
||||
std::string getInfoURL();
|
||||
void setInfoURL(std::string infoURL);
|
||||
bool addType(HEPREP::HepRepType* type);
|
||||
std::vector<HEPREP::HepRepType*>* getTypes();
|
||||
void addType(HEPREP::HepRepType* type);
|
||||
std::set<HEPREP::HepRepType*> getTypes();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include "HEPREP/HepRep.h"
|
||||
#include "HEPREP/HepRepTypeTree.h"
|
||||
@@ -21,16 +22,16 @@
|
||||
class DefaultHepRepTypeTree : public DefaultHepRepTreeID, public virtual HEPREP::HepRepTypeTree {
|
||||
|
||||
private:
|
||||
std::vector<HEPREP::HepRepType*> types;
|
||||
std::set<HEPREP::HepRepType*> types;
|
||||
|
||||
public:
|
||||
DefaultHepRepTypeTree(HEPREP::HepRepTreeID* typeTree);
|
||||
~DefaultHepRepTypeTree();
|
||||
|
||||
HEPREP::HepRepTypeTree* copy(HEPREP::HepRep* heprep);
|
||||
HEPREP::HepRepTreeID* copy();
|
||||
bool addType(HEPREP::HepRepType* type);
|
||||
std::vector<HEPREP::HepRepType* >* getTypes();
|
||||
HEPREP::HepRepTypeTree* copy();
|
||||
void addType(HEPREP::HepRepType* type);
|
||||
std::set<HEPREP::HepRepType* > getTypes();
|
||||
HEPREP::HepRepType* getType(std::string name);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,11 +4,23 @@
|
||||
#ifdef WIN32
|
||||
#ifndef GNU_GCC
|
||||
// Disable warning C4786: identifier was truncated to '255' characters in the debug information
|
||||
#pragma warning ( disable : 4786 )
|
||||
#pragma warning ( disable : 4786 )
|
||||
// Disable warning C4250: inherits via dominance
|
||||
#pragma warning ( disable : 4250 )
|
||||
#endif
|
||||
#endif
|
||||
#pragma warning ( disable : 4250 )
|
||||
#ifdef VC6
|
||||
// FIX for KB 168440 - VC6
|
||||
// Stream Operator << Cannot Handle __int64 Type
|
||||
#include<iostream>
|
||||
|
||||
#endif
|
||||
inline std::ostream& operator<<(std::ostream& os, __int64 i ) {
|
||||
char buf[20];
|
||||
sprintf(buf,"%I64d", i );
|
||||
os << buf;
|
||||
return os;
|
||||
}
|
||||
#endif // VC6
|
||||
#endif // GNU_GCC
|
||||
#endif // WIN32
|
||||
|
||||
#endif // FREEHEPTYPES_H
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <stack>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "zipios++/zipoutputstream.h"
|
||||
#include "zipios++/gzipoutputstream.h"
|
||||
@@ -38,14 +40,16 @@ class XMLHepRepWriter : public virtual HEPREP::HepRepWriter {
|
||||
XMLWriter *xml;
|
||||
zipios::ZipOutputStream *zip;
|
||||
zipios::GZIPOutputStream *gz;
|
||||
|
||||
std::map<std::string, std::string> properties;
|
||||
|
||||
public:
|
||||
XMLHepRepWriter(std::ostream* out, bool randomAccess, bool compress);
|
||||
~XMLHepRepWriter();
|
||||
|
||||
bool addProperty(std::string key, std::string value);
|
||||
bool close();
|
||||
bool write(HEPREP::HepRep* heprep, std::string name);
|
||||
bool write(std::vector<std::string> *layers);
|
||||
bool write(std::vector<std::string> layers);
|
||||
bool write(HEPREP::HepRepTypeTree* typeTree);
|
||||
bool write(HEPREP::HepRepType* type);
|
||||
bool write(HEPREP::HepRepTreeID* treeID);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* For conditions of distribution and use, see copyright notice in HepRep-zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id: HepRep-zconf.h,v 1.1 2004/02/03 19:34:43 duns Exp $ */
|
||||
/* @(#) $Id: HepRep-zconf.h,v 1.2 2004/06/16 21:05:27 duns Exp $ */
|
||||
|
||||
#ifndef _HEPREP_ZCONF_H
|
||||
#define _HEPREP_ZCONF_H
|
||||
@@ -16,39 +16,43 @@
|
||||
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
||||
*/
|
||||
#ifdef Z_PREFIX
|
||||
# define deflateInit_ z_deflateInit_
|
||||
# define deflate z_deflate
|
||||
# define deflateEnd z_deflateEnd
|
||||
# define inflateInit_ z_inflateInit_
|
||||
# define inflate z_inflate
|
||||
# define inflateEnd z_inflateEnd
|
||||
# define deflateInit2_ z_deflateInit2_
|
||||
# define deflateSetDictionary z_deflateSetDictionary
|
||||
# define deflateCopy z_deflateCopy
|
||||
# define deflateReset z_deflateReset
|
||||
# define deflateParams z_deflateParams
|
||||
# define inflateInit2_ z_inflateInit2_
|
||||
# define inflateSetDictionary z_inflateSetDictionary
|
||||
# define inflateSync z_inflateSync
|
||||
# define inflateSyncPoint z_inflateSyncPoint
|
||||
# define inflateReset z_inflateReset
|
||||
# define compress z_compress
|
||||
# define compress2 z_compress2
|
||||
# define uncompress z_uncompress
|
||||
# define adler32 z_adler32
|
||||
# define crc32 z_crc32
|
||||
# define get_crc_table z_get_crc_table
|
||||
/* MD: changes z_ into heprep_z_ */
|
||||
# define deflateInit_ heprep_z_deflateInit_
|
||||
# define deflate heprep_z_deflate
|
||||
# define deflateEnd heprep_z_deflateEnd
|
||||
# define inflateInit_ heprep_z_inflateInit_
|
||||
# define inflate heprep_z_inflate
|
||||
# define inflateEnd heprep_z_inflateEnd
|
||||
# define deflateInit2_ heprep_z_deflateInit2_
|
||||
# define deflateSetDictionary heprep_z_deflateSetDictionary
|
||||
# define deflateCopy heprep_z_deflateCopy
|
||||
# define deflateReset heprep_z_deflateReset
|
||||
# define deflateParams heprep_z_deflateParams
|
||||
# define inflateInit2_ heprep_z_inflateInit2_
|
||||
# define inflateSetDictionary heprep_z_inflateSetDictionary
|
||||
# define inflateSync heprep_z_inflateSync
|
||||
# define inflateSyncPoint heprep_z_inflateSyncPoint
|
||||
# define inflateReset heprep_z_inflateReset
|
||||
# define compress heprep_z_compress
|
||||
# define compress2 heprep_z_compress2
|
||||
# define uncompress heprep_z_uncompress
|
||||
# define adler32 heprep_z_adler32
|
||||
# define crc32 heprep_z_crc32
|
||||
# define get_crc_table heprep_z_get_crc_table
|
||||
|
||||
# define Byte z_Byte
|
||||
# define uInt z_uInt
|
||||
# define uLong z_uLong
|
||||
# define Bytef z_Bytef
|
||||
# define charf z_charf
|
||||
# define intf z_intf
|
||||
# define uIntf z_uIntf
|
||||
# define uLongf z_uLongf
|
||||
# define voidpf z_voidpf
|
||||
# define voidp z_voidp
|
||||
# define Byte heprep_z_Byte
|
||||
# define uInt heprep_z_uInt
|
||||
# define uLong heprep_z_uLong
|
||||
# define Bytef heprep_z_Bytef
|
||||
# define charf heprep_z_charf
|
||||
# define intf heprep_z_intf
|
||||
# define uIntf heprep_z_uIntf
|
||||
# define uLongf heprep_z_uLongf
|
||||
# define voidpf heprep_z_voidpf
|
||||
# define voidp heprep_z_voidp
|
||||
|
||||
/* MD: added define for lonely symbol not renamed... */
|
||||
# define z_errmsg heprep_z_errmsg
|
||||
#endif
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
|
||||
|
||||
@@ -8,10 +8,10 @@ DefaultHepRep::DefaultHepRep() {
|
||||
}
|
||||
|
||||
DefaultHepRep::~DefaultHepRep() {
|
||||
for (vector<HepRepTypeTree*>::iterator i1 = typeTrees.begin(); i1 != typeTrees.end(); i1++) {
|
||||
for (set<HepRepTypeTree*>::iterator i1 = typeTrees.begin(); i1 != typeTrees.end(); i1++) {
|
||||
delete (*i1);
|
||||
}
|
||||
for (vector<HepRepInstanceTree*>::iterator i2 = instanceTrees.begin(); i2 != instanceTrees.end(); i2++) {
|
||||
for (set<HepRepInstanceTree*>::iterator i2 = instanceTrees.begin(); i2 != instanceTrees.end(); i2++) {
|
||||
delete (*i2);
|
||||
}
|
||||
}
|
||||
@@ -21,18 +21,16 @@ HepRep* DefaultHepRep::copy(HepRepSelectFilter*) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vector<string>* DefaultHepRep::getLayerOrder() {
|
||||
return &layers;
|
||||
vector<string> DefaultHepRep::getLayerOrder() {
|
||||
return layers;
|
||||
}
|
||||
|
||||
bool DefaultHepRep::addLayer(string layer) {
|
||||
void DefaultHepRep::addLayer(string layer) {
|
||||
layers.push_back(layer);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DefaultHepRep::addTypeTree(HepRepTypeTree* typeTree) {
|
||||
typeTrees.push_back(typeTree);
|
||||
return true;
|
||||
void DefaultHepRep::addTypeTree(HepRepTypeTree* typeTree) {
|
||||
typeTrees.insert(typeTree);
|
||||
}
|
||||
|
||||
void DefaultHepRep::removeTypeTree(HepRepTypeTree*) {
|
||||
@@ -44,18 +42,12 @@ HepRepTypeTree* DefaultHepRep::getTypeTree(string, string) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vector<HepRepTypeTree*>* DefaultHepRep::getTypeTrees() {
|
||||
return &typeTrees;
|
||||
set<HepRepTypeTree*> DefaultHepRep::getTypeTrees() {
|
||||
return typeTrees;
|
||||
}
|
||||
|
||||
HepRepType* DefaultHepRep::getType(string) {
|
||||
cerr << "DefaultHepRep::getType(string) not implemented." << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool DefaultHepRep::addInstanceTree(HepRepInstanceTree* instanceTree) {
|
||||
instanceTrees.push_back(instanceTree);
|
||||
return true;
|
||||
void DefaultHepRep::addInstanceTree(HepRepInstanceTree* instanceTree) {
|
||||
instanceTrees.insert(instanceTree);
|
||||
}
|
||||
|
||||
void DefaultHepRep::overlayInstanceTree(HepRepInstanceTree *) {
|
||||
@@ -94,7 +86,7 @@ string DefaultHepRep::checkForException() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vector<HepRepInstanceTree*>* DefaultHepRep::getInstanceTrees() {
|
||||
return &instanceTrees;
|
||||
set<HepRepInstanceTree*> DefaultHepRep::getInstanceTrees() {
|
||||
return instanceTrees;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,56 +16,53 @@ DefaultHepRepAttribute::~DefaultHepRepAttribute() {
|
||||
for (map<string, HepRepAttValue*>::iterator i = attValues.begin(); i != attValues.end(); i++) {
|
||||
delete (*i).second;
|
||||
}
|
||||
|
||||
attList.clear();
|
||||
}
|
||||
|
||||
vector<HepRepAttValue*>* DefaultHepRepAttribute::getAttValuesFromNode() {
|
||||
attList.clear();
|
||||
set<HepRepAttValue*> DefaultHepRepAttribute::getAttValuesFromNode() {
|
||||
set<HepRepAttValue*> attSet;
|
||||
for (map<string, HepRepAttValue*>::iterator i = attValues.begin(); i != attValues.end(); i++) {
|
||||
if ((*i).first != "layer") attList.push_back((*i).second);
|
||||
if ((*i).first != "layer") attSet.insert((*i).second);
|
||||
}
|
||||
return &attList;
|
||||
return attSet;
|
||||
}
|
||||
|
||||
bool DefaultHepRepAttribute::addAttValue(HepRepAttValue* hepRepAttValue) {
|
||||
void DefaultHepRepAttribute::addAttValue(HepRepAttValue* hepRepAttValue) {
|
||||
string lowerCaseName = hepRepAttValue->getLowerCaseName();
|
||||
if (attValues[lowerCaseName] != NULL) delete attValues[lowerCaseName];
|
||||
attValues[lowerCaseName] = hepRepAttValue;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DefaultHepRepAttribute::addAttValue(string key, char *value, int showLabel) {
|
||||
return addAttValue(key, (std::string)value, showLabel);
|
||||
void DefaultHepRepAttribute::addAttValue(string key, char *value, int showLabel) {
|
||||
addAttValue(key, (std::string)value, showLabel);
|
||||
}
|
||||
|
||||
bool DefaultHepRepAttribute::addAttValue(string key, string value, int showLabel) {
|
||||
return addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
|
||||
void DefaultHepRepAttribute::addAttValue(string key, string value, int showLabel) {
|
||||
addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
|
||||
}
|
||||
|
||||
bool DefaultHepRepAttribute::addAttValue(string key, int value, int showLabel) {
|
||||
return addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
|
||||
void DefaultHepRepAttribute::addAttValue(string key, int value, int showLabel) {
|
||||
addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
|
||||
}
|
||||
|
||||
bool DefaultHepRepAttribute::addAttValue(string key, double value, int showLabel) {
|
||||
return addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
|
||||
void DefaultHepRepAttribute::addAttValue(string key, double value, int showLabel) {
|
||||
addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
|
||||
}
|
||||
|
||||
bool DefaultHepRepAttribute::addAttValue(string key, bool value, int showLabel) {
|
||||
return addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
|
||||
void DefaultHepRepAttribute::addAttValue(string key, bool value, int showLabel) {
|
||||
addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
|
||||
}
|
||||
|
||||
bool DefaultHepRepAttribute::addAttValue(string key, vector<double> value, int showLabel) {
|
||||
return addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
|
||||
void DefaultHepRepAttribute::addAttValue(string key, vector<double> value, int showLabel) {
|
||||
addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
|
||||
}
|
||||
|
||||
bool DefaultHepRepAttribute::addAttValue(string key, double red, double green, double blue, double alpha, int showLabel) {
|
||||
void DefaultHepRepAttribute::addAttValue(string key, double red, double green, double blue, double alpha, int showLabel) {
|
||||
vector<double> color;
|
||||
color.push_back(red);
|
||||
color.push_back(green);
|
||||
color.push_back(blue);
|
||||
color.push_back(alpha);
|
||||
return addAttValue(new DefaultHepRepAttValue(key, color, showLabel));
|
||||
addAttValue(new DefaultHepRepAttValue(key, color, showLabel));
|
||||
}
|
||||
|
||||
HepRepAttValue* DefaultHepRepAttribute::getAttValueFromNode(string name) {
|
||||
|
||||
@@ -13,29 +13,28 @@ DefaultHepRepDefinition::DefaultHepRepDefinition()
|
||||
}
|
||||
|
||||
DefaultHepRepDefinition::~DefaultHepRepDefinition() {
|
||||
vector<HepRepAttDef *>* list = getAttDefsFromNode();
|
||||
for (vector<HepRepAttDef*>::iterator i1 = list->begin(); i1 != list->end(); i1++) {
|
||||
set<HepRepAttDef *> list = getAttDefsFromNode();
|
||||
for (set<HepRepAttDef*>::iterator i1 = list.begin(); i1 != list.end(); i1++) {
|
||||
delete (*i1);
|
||||
}
|
||||
}
|
||||
|
||||
vector<HepRepAttDef *>* DefaultHepRepDefinition::getAttDefsFromNode() {
|
||||
attList.clear();
|
||||
set<HepRepAttDef *> DefaultHepRepDefinition::getAttDefsFromNode() {
|
||||
set<HepRepAttDef*> attSet;
|
||||
for (map<string, HepRepAttDef*>::iterator i = attDefs.begin(); i != attDefs.end(); i++) {
|
||||
attList.push_back((*i).second);
|
||||
attSet.insert((*i).second);
|
||||
}
|
||||
return &attList;
|
||||
return attSet;
|
||||
}
|
||||
|
||||
bool DefaultHepRepDefinition::addAttDef(HepRepAttDef* hepRepAttDef) {
|
||||
void DefaultHepRepDefinition::addAttDef(HepRepAttDef* hepRepAttDef) {
|
||||
string lowerCaseName = hepRepAttDef->getLowerCaseName();
|
||||
if (attDefs[lowerCaseName] != NULL) delete attDefs[lowerCaseName];
|
||||
attDefs[lowerCaseName] = hepRepAttDef;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DefaultHepRepDefinition::addAttDef(string name, string desc, string type, string extra) {
|
||||
return addAttDef(new DefaultHepRepAttDef(name, desc, type, extra));
|
||||
void DefaultHepRepDefinition::addAttDef(string name, string desc, string type, string extra) {
|
||||
addAttDef(new DefaultHepRepAttDef(name, desc, type, extra));
|
||||
}
|
||||
|
||||
HepRepAttDef* DefaultHepRepDefinition::getAttDefFromNode(string name) {
|
||||
|
||||
@@ -67,6 +67,10 @@ HepRepType* DefaultHepRepFactory::createHepRepType (HepRepType* parent, string n
|
||||
return new DefaultHepRepType(parent, name);
|
||||
}
|
||||
|
||||
HepRepType* DefaultHepRepFactory::createHepRepType (HepRepTypeTree* parent, string name) {
|
||||
return new DefaultHepRepType(parent, name);
|
||||
}
|
||||
|
||||
HepRepTypeTree* DefaultHepRepFactory::createHepRepTypeTree (HepRepTreeID* treeID) {
|
||||
return new DefaultHepRepTypeTree(treeID);
|
||||
}
|
||||
|
||||
@@ -10,14 +10,14 @@ DefaultHepRepInstance::DefaultHepRepInstance(HepRepInstance* instance, HepRepTyp
|
||||
: DefaultHepRepAttribute(), parent(instance), type(heprepType) {
|
||||
|
||||
if (type == NULL) cerr << "HepRepInstance cannot be created without a HepRepType." << endl;
|
||||
((HepRepInstance*)parent)->addInstance(this);
|
||||
parent->addInstance(this);
|
||||
}
|
||||
|
||||
DefaultHepRepInstance::DefaultHepRepInstance(HepRepInstanceTree* instanceTree, HepRepType* heprepType)
|
||||
: DefaultHepRepAttribute(), parent(instanceTree), type(heprepType) {
|
||||
: DefaultHepRepAttribute(), parent(NULL), type(heprepType) {
|
||||
|
||||
if (type == NULL) cerr << "HepRepInstance cannot be created without a HepRepType." << endl;
|
||||
((HepRepInstanceTree*)parent)->addInstance(this);
|
||||
instanceTree->addInstance(this);
|
||||
}
|
||||
|
||||
DefaultHepRepInstance::~DefaultHepRepInstance() {
|
||||
@@ -35,13 +35,13 @@ void DefaultHepRepInstance::overlay(HepRepInstance *) {
|
||||
cerr << "DefaultHepRepInstance::overlay(HepRepInstance * instance) not implemented." << endl;
|
||||
}
|
||||
|
||||
HepRepInstance* DefaultHepRepInstance::copy(HepRep*, HepRepInstance*, HepRepSelectFilter*) {
|
||||
cerr << "DefaultHepRepInstance::copy(HepRep*, HepRepInstance*, HepRepSelectFilter*) not implemented." << endl;
|
||||
HepRepInstance* DefaultHepRepInstance::copy(HepRepTypeTree*, HepRepInstance*, HepRepSelectFilter*) {
|
||||
cerr << "DefaultHepRepInstance::copy(HepRepTypeTree*, HepRepInstance*, HepRepSelectFilter*) not implemented." << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HepRepInstance* DefaultHepRepInstance::copy(HepRep*, HepRepInstanceTree*, HepRepSelectFilter*) {
|
||||
cerr << "DefaultHepRepInstance::copy(HepRep*, HepRepInstanceTree*, HepRepSelectFilter*) not implemented." << endl;
|
||||
HepRepInstance* DefaultHepRepInstance::copy(HepRepTypeTree*, HepRepInstanceTree*, HepRepSelectFilter*) {
|
||||
cerr << "DefaultHepRepInstance::copy(HepRepTypeTree*, HepRepInstanceTree*, HepRepSelectFilter*) not implemented." << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -49,26 +49,28 @@ HepRepType* DefaultHepRepInstance::getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
bool DefaultHepRepInstance::addPoint(HepRepPoint* point) {
|
||||
void DefaultHepRepInstance::addPoint(HepRepPoint* point) {
|
||||
points.push_back(point);
|
||||
return true;
|
||||
}
|
||||
|
||||
vector<HepRepPoint*>* DefaultHepRepInstance::getPoints() {
|
||||
return &points;
|
||||
vector<HepRepPoint*> DefaultHepRepInstance::getPoints() {
|
||||
return points;
|
||||
}
|
||||
|
||||
bool DefaultHepRepInstance::addInstance(HepRepInstance* instance) {
|
||||
HepRepInstance* DefaultHepRepInstance::getSuperInstance() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
void DefaultHepRepInstance::addInstance(HepRepInstance* instance) {
|
||||
instances.push_back(instance);
|
||||
return true;
|
||||
}
|
||||
|
||||
void DefaultHepRepInstance::removeInstance(HepRepInstance*) {
|
||||
cerr << "DefaultHepRepInstance::removeInstance(HepRepInstance*) not implemented." << endl;
|
||||
}
|
||||
|
||||
vector<HepRepInstance*>* DefaultHepRepInstance::getInstances() {
|
||||
return &instances;
|
||||
vector<HepRepInstance*> DefaultHepRepInstance::getInstances() {
|
||||
return instances;
|
||||
}
|
||||
|
||||
HepRepAttValue* DefaultHepRepInstance::getAttValue(string name) {
|
||||
|
||||
@@ -19,38 +19,32 @@ void DefaultHepRepInstanceTree::overlay(HepRepInstanceTree *) {
|
||||
cerr << "DefaultHepRepInstanceTree::overlay(HepRepInstanceTree * instanceTree) not implemented." << endl;
|
||||
}
|
||||
|
||||
HepRepTreeID* DefaultHepRepInstanceTree::copy() {
|
||||
return DefaultHepRepTreeID::copy();
|
||||
}
|
||||
|
||||
HepRepInstanceTree* DefaultHepRepInstanceTree::copy(HepRep*, HepRepSelectFilter*) {
|
||||
cerr << "DefaultHepRepInstanceTree::copy(HepRep*, HepRepSelectFilter*) not implemented." << endl;
|
||||
HepRepInstanceTree* DefaultHepRepInstanceTree::copy(HepRepTypeTree*, HepRepSelectFilter*) {
|
||||
cerr << "DefaultHepRepInstanceTree::copy(HepRepTypeTree*, HepRepSelectFilter*) not implemented." << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool DefaultHepRepInstanceTree::addInstance(HepRepInstance* instance) {
|
||||
void DefaultHepRepInstanceTree::addInstance(HepRepInstance* instance) {
|
||||
instances.push_back(instance);
|
||||
return true;
|
||||
}
|
||||
|
||||
void DefaultHepRepInstanceTree::removeInstance(HepRepInstance*) {
|
||||
cerr << "DefaultHepRepInstanceTree::removeInstance(HepRepInstance*) not implemented." << endl;
|
||||
}
|
||||
|
||||
vector<HepRepInstance*>* DefaultHepRepInstanceTree::getInstances() {
|
||||
return &instances;
|
||||
vector<HepRepInstance*> DefaultHepRepInstanceTree::getInstances() {
|
||||
return instances;
|
||||
}
|
||||
|
||||
bool DefaultHepRepInstanceTree::addInstanceTree(HepRepTreeID* treeID) {
|
||||
instanceTrees.push_back(treeID);
|
||||
return true;
|
||||
void DefaultHepRepInstanceTree::addInstanceTree(HepRepTreeID* treeID) {
|
||||
instanceTrees.insert(treeID);
|
||||
}
|
||||
|
||||
HepRepTreeID* DefaultHepRepInstanceTree::getTypeTree() {
|
||||
return typeTree;
|
||||
}
|
||||
|
||||
vector<HepRepTreeID*>* DefaultHepRepInstanceTree::getInstanceTrees() {
|
||||
return &instanceTrees;
|
||||
set<HepRepTreeID*> DefaultHepRepInstanceTree::getInstanceTrees() {
|
||||
return instanceTrees;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,3 @@ string DefaultHepRepTreeID::getName() {
|
||||
string DefaultHepRepTreeID::getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
HepRepTreeID* DefaultHepRepTreeID::copy() {
|
||||
return new DefaultHepRepTreeID(name, version, qualifier);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,16 @@ DefaultHepRepType::DefaultHepRepType(HepRepType* parentType, string typeName)
|
||||
}
|
||||
}
|
||||
|
||||
DefaultHepRepType::DefaultHepRepType(HepRepTypeTree* parentTypeTree, string typeName)
|
||||
: DefaultHepRepDefinition(), parent(NULL), name(typeName) {
|
||||
this->description = "No Description";
|
||||
this->infoURL = "No Info URL";
|
||||
|
||||
parentTypeTree->addType(this);
|
||||
}
|
||||
|
||||
DefaultHepRepType::~DefaultHepRepType() {
|
||||
for (vector<HepRepType*>::iterator i1 = types.begin(); i1 != types.end(); i1++) {
|
||||
for (set<HepRepType*>::iterator i1 = types.begin(); i1 != types.end(); i1++) {
|
||||
delete (*i1);
|
||||
}
|
||||
}
|
||||
@@ -56,8 +64,8 @@ HepRepAttValue* DefaultHepRepType::getAttValue(string attName) {
|
||||
return value;
|
||||
}
|
||||
|
||||
HepRepType* DefaultHepRepType::copy(HepRep*, HepRepType*) {
|
||||
cerr << "DefaultHepRepType::copy(HepRep*, HepRepType*) not implemented." << endl;
|
||||
HepRepType* DefaultHepRepType::copy(HepRepType*) {
|
||||
cerr << "DefaultHepRepType::copy(HepRepType*) not implemented." << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -85,12 +93,11 @@ void DefaultHepRepType::setInfoURL(string info) {
|
||||
this->infoURL = info;
|
||||
}
|
||||
|
||||
bool DefaultHepRepType::addType(HepRepType* type) {
|
||||
types.push_back(type);
|
||||
return true;
|
||||
void DefaultHepRepType::addType(HepRepType* type) {
|
||||
types.insert(type);
|
||||
}
|
||||
|
||||
vector<HepRepType*>* DefaultHepRepType::getTypes() {
|
||||
return &types;
|
||||
set<HepRepType*> DefaultHepRepType::getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,26 +12,25 @@ DefaultHepRepTypeTree::DefaultHepRepTypeTree(HepRepTreeID* typeTree)
|
||||
}
|
||||
|
||||
DefaultHepRepTypeTree::~DefaultHepRepTypeTree() {
|
||||
for (vector<HepRepType*>::iterator i1 = types.begin(); i1 != types.end(); i1++) {
|
||||
for (set<HepRepType*>::iterator i1 = types.begin(); i1 != types.end(); i1++) {
|
||||
delete (*i1);
|
||||
}
|
||||
}
|
||||
|
||||
HepRepTreeID* DefaultHepRepTypeTree::copy() {
|
||||
return DefaultHepRepTreeID::copy();
|
||||
}
|
||||
|
||||
HepRepTypeTree* DefaultHepRepTypeTree::copy(HepRep*) {
|
||||
cerr << "DefaultHepRepTypeTree::copy(HepRep*) not implemented." << endl;
|
||||
HepRepTypeTree* DefaultHepRepTypeTree::copy() {
|
||||
cerr << "DefaultHepRepTypeTree::copy() not implemented." << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool DefaultHepRepTypeTree::addType(HepRepType* type) {
|
||||
types.push_back(type);
|
||||
return true;
|
||||
void DefaultHepRepTypeTree::addType(HepRepType* type) {
|
||||
types.insert(type);
|
||||
}
|
||||
|
||||
vector<HepRepType*>* DefaultHepRepTypeTree::getTypes() {
|
||||
return &types;
|
||||
set<HepRepType*> DefaultHepRepTypeTree::getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
HepRepType* DefaultHepRepTypeTree::getType(string /*typeName*/) {
|
||||
cerr << "DefaultHepRepTypeTree::getType(string) not implemented." << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HepRep.cc,v 1.20 2003/12/11 21:55:55 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4HepRep.cc,v 1.21 2004/05/27 05:55:20 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
|
||||
/**
|
||||
@@ -71,7 +71,7 @@ G4VViewer* G4HepRep::CreateViewer (G4VSceneHandler& scene, const G4String& name)
|
||||
cout << "G4HepRep::CreateViewer: Cannot create more than one G4HepRepViewer" << endl;
|
||||
return NULL;
|
||||
}
|
||||
viewer = new G4HepRepViewer ((G4HepRepSceneHandler&)scene, name);
|
||||
viewer = new G4HepRepViewer ((G4HepRepSceneHandler&)scene, *messenger, name);
|
||||
return viewer;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HepRepFileSceneHandler.cc,v 1.18 2004/03/15 08:00:22 perl Exp $
|
||||
// GEANT4 tag $Name: geant4-06-01 $
|
||||
// $Id: G4HepRepFileSceneHandler.cc,v 1.19 2004/05/28 04:59:54 perl Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//
|
||||
// Joseph Perl 27th January 2002
|
||||
@@ -674,6 +674,8 @@ void G4HepRepFileSceneHandler::AddHepRepInstance(const char* primName,
|
||||
// Additional attributes.
|
||||
hepRepXMLWriter->addAttValue("Layer",hepRepXMLWriter->typeDepth);
|
||||
hepRepXMLWriter->addAttValue("LVol", fpCurrentLV->GetName());
|
||||
hepRepXMLWriter->addAttValue("Region", fpCurrentLV->GetRegion()->GetName());
|
||||
hepRepXMLWriter->addAttValue("RootRegion", fpCurrentLV->IsRootRegion());
|
||||
hepRepXMLWriter->addAttValue("Solid", fpCurrentLV->GetSolid()->GetName());
|
||||
hepRepXMLWriter->addAttValue("EType", fpCurrentLV->GetSolid()->GetEntityType());
|
||||
hepRepXMLWriter->addAttValue("Material", fpCurrentLV->GetMaterial()->GetName());
|
||||
@@ -731,6 +733,8 @@ void G4HepRepFileSceneHandler::CheckFileOpen() {
|
||||
fileCounter++;
|
||||
|
||||
hepRepXMLWriter->addAttDef("LVol", "Logical Volume", "Physics","");
|
||||
hepRepXMLWriter->addAttDef("Region", "Cuts Region", "Physics","");
|
||||
hepRepXMLWriter->addAttDef("RootRegion", "Root Region", "Physics","");
|
||||
hepRepXMLWriter->addAttDef("Solid", "Solid Name", "Physics","");
|
||||
hepRepXMLWriter->addAttDef("EType", "Entity Type", "Physics","");
|
||||
hepRepXMLWriter->addAttDef("Material", "Material Name", "Physics","");
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HepRepMessenger.cc,v 1.4 2003/12/11 21:55:55 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4HepRepMessenger.cc,v 1.6 2004/05/27 05:55:20 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
#include "G4HepRepMessenger.hh"
|
||||
|
||||
@@ -39,35 +39,42 @@ G4HepRepMessenger::G4HepRepMessenger() :
|
||||
setEventNumberSuffixCommand->SetDefaultValue("");
|
||||
setEventNumberSuffixCommand->AvailableForStates(G4State_Idle);
|
||||
|
||||
/*
|
||||
appendGeometryCommand = new G4UIcmdWithABool("/vis/heprep/appendGeometry", this);
|
||||
appendGeometryCommand->SetGuidance("Appends copy of geometry to every event.");
|
||||
appendGeometryCommand->SetParameterName("flag",false);
|
||||
appendGeometryCommand->SetDefaultValue(true);
|
||||
appendGeometryCommand->AvailableForStates(G4State_Idle);
|
||||
*/
|
||||
|
||||
addPointAttributesCommand = new G4UIcmdWithABool("/vis/heprep/addPointAttributes", this);
|
||||
addPointAttributesCommand->SetGuidance("Adds point attributes to the points of trajectories.");
|
||||
addPointAttributesCommand->SetParameterName("flag",false);
|
||||
addPointAttributesCommand->SetDefaultValue(false);
|
||||
addPointAttributesCommand->AvailableForStates(G4State_Idle);
|
||||
|
||||
setCoordinateSystemCommand = new G4UIcmdWithAString("/vis/heprep/setCoordinateSystem", this);
|
||||
setCoordinateSystemCommand->SetGuidance("Sets the prefered Coordinate System (e.g. \"xyz\" or \"zxy\".");
|
||||
setCoordinateSystemCommand->SetParameterName("coordinateSystem",false);
|
||||
setCoordinateSystemCommand->SetDefaultValue("xyz");
|
||||
setCoordinateSystemCommand->AvailableForStates(G4State_Idle);
|
||||
}
|
||||
|
||||
G4HepRepMessenger::~G4HepRepMessenger() {
|
||||
delete setEventNumberSuffixCommand;
|
||||
// delete appendGeometryCommand;
|
||||
delete appendGeometryCommand;
|
||||
delete addPointAttributesCommand;
|
||||
delete heprepDirectory;
|
||||
delete setCoordinateSystemCommand;
|
||||
}
|
||||
|
||||
G4String G4HepRepMessenger::GetCurrentValue(G4UIcommand * command) {
|
||||
if (command==setEventNumberSuffixCommand) {
|
||||
return suffix;
|
||||
// } else if (command==appendGeometryCommand) {
|
||||
// return appendGeometryCommand->ConvertToString(geometry);
|
||||
} else if (command==appendGeometryCommand) {
|
||||
return appendGeometryCommand->ConvertToString(geometry);
|
||||
} else if (command==addPointAttributesCommand) {
|
||||
return addPointAttributesCommand->ConvertToString(pointAttributes);
|
||||
} else if (command==setCoordinateSystemCommand) {
|
||||
return coordinateSystem;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
@@ -76,10 +83,12 @@ G4String G4HepRepMessenger::GetCurrentValue(G4UIcommand * command) {
|
||||
void G4HepRepMessenger::SetNewValue(G4UIcommand * command, G4String newValue) {
|
||||
if (command==setEventNumberSuffixCommand) {
|
||||
suffix = newValue;
|
||||
// } else if (command==appendGeometryCommand) {
|
||||
// geometry = appendGeometryCommand->GetNewBoolValue(newValue);
|
||||
} else if (command==appendGeometryCommand) {
|
||||
geometry = appendGeometryCommand->GetNewBoolValue(newValue);
|
||||
} else if (command==addPointAttributesCommand) {
|
||||
pointAttributes = addPointAttributesCommand->GetNewBoolValue(newValue);
|
||||
} else if (command==setCoordinateSystemCommand) {
|
||||
coordinateSystem = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,3 +103,7 @@ G4bool G4HepRepMessenger::appendGeometry() {
|
||||
G4bool G4HepRepMessenger::addPointAttributes() {
|
||||
return pointAttributes;
|
||||
}
|
||||
|
||||
G4String G4HepRepMessenger::getCoordinateSystem() {
|
||||
return coordinateSystem;
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HepRepSceneHandler.cc,v 1.70 2004/02/05 18:41:49 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4HepRepSceneHandler.cc,v 1.76 2004/05/28 04:59:54 perl Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
|
||||
/**
|
||||
@@ -43,6 +43,8 @@
|
||||
#include "HEPREP/HepRep.h"
|
||||
|
||||
//G4
|
||||
#include "G4Vector3D.hh"
|
||||
#include "G4RunManagerKernel.hh"
|
||||
#include "G4Types.hh"
|
||||
#include "G4Point3D.hh"
|
||||
#include "G4Normal3D.hh"
|
||||
@@ -78,6 +80,7 @@ using namespace std;
|
||||
|
||||
G4int G4HepRepSceneHandler::sceneCount = 0;
|
||||
|
||||
//#define LDEBUG 1
|
||||
//#define SDEBUG 1
|
||||
//#define PDEBUG 1
|
||||
|
||||
@@ -100,10 +103,11 @@ G4HepRepSceneHandler::G4HepRepSceneHandler (G4VGraphicsSystem& system, G4HepRepM
|
||||
currentDepth (0),
|
||||
currentPV (0),
|
||||
currentLV (0),
|
||||
_heprep (NULL)
|
||||
_heprep (NULL),
|
||||
_heprepGeometry (NULL)
|
||||
{
|
||||
|
||||
#ifdef SDEBUG
|
||||
#ifdef LDEBUG
|
||||
cout << "G4HepRepSceneHandler::G4HepRepSceneHandler: " << system << endl;
|
||||
#endif
|
||||
|
||||
@@ -121,7 +125,7 @@ G4HepRepSceneHandler::G4HepRepSceneHandler (G4VGraphicsSystem& system, G4HepRepM
|
||||
|
||||
|
||||
G4HepRepSceneHandler::~G4HepRepSceneHandler () {
|
||||
#ifdef SDEBUG
|
||||
#ifdef LDEBUG
|
||||
cout << "G4HepRepSceneHandler::~G4HepRepSceneHandler() " << endl;
|
||||
#endif
|
||||
close();
|
||||
@@ -137,7 +141,7 @@ void G4HepRepSceneHandler::open(G4String name) {
|
||||
if (writer != NULL) return;
|
||||
|
||||
if (name == "stdout") {
|
||||
#ifdef SDEBUG
|
||||
#ifdef LDEBUG
|
||||
cout << "G4HepRepSceneHandler::Open() stdout" << endl;
|
||||
#endif
|
||||
writer = factory->createHepRepWriter(&cout, false, false);
|
||||
@@ -150,7 +154,7 @@ void G4HepRepSceneHandler::open(G4String name) {
|
||||
eventNumber = 0;
|
||||
eventNumberWidth = 0;
|
||||
} else if (name == "stderr") {
|
||||
#ifdef SDEBUG
|
||||
#ifdef LDEBUG
|
||||
cout << "G4HepRepSceneHandler::Open() stderr" << endl;
|
||||
#endif
|
||||
writer = factory->createHepRepWriter(&cerr, false, false);
|
||||
@@ -163,7 +167,7 @@ void G4HepRepSceneHandler::open(G4String name) {
|
||||
eventNumber = 0;
|
||||
eventNumberWidth = 0;
|
||||
} else {
|
||||
#ifdef SDEBUG
|
||||
#ifdef LDEBUG
|
||||
cout << "G4HepRepSceneHandler::Open() " << name << endl;
|
||||
#endif
|
||||
if (eventNumberWidth < 0) {
|
||||
@@ -231,13 +235,14 @@ void G4HepRepSceneHandler::open(G4String name) {
|
||||
|
||||
|
||||
void G4HepRepSceneHandler::openHepRep() {
|
||||
#ifdef SDEBUG
|
||||
#ifdef LDEBUG
|
||||
cout << "G4HepRepSceneHandler::OpenHepRep() " << endl;
|
||||
#endif
|
||||
|
||||
if (_heprep != NULL) return;
|
||||
|
||||
// all done on demand, once pointers are set to NULL
|
||||
_heprepGeometry = NULL;
|
||||
_geometryInstanceTree = NULL;
|
||||
_geometryRootInstance = NULL;
|
||||
_geometryInstance.clear();
|
||||
@@ -262,7 +267,7 @@ void G4HepRepSceneHandler::openHepRep() {
|
||||
bool G4HepRepSceneHandler::closeHepRep(bool final) {
|
||||
if (_heprep == NULL) return true;
|
||||
|
||||
#ifdef SDEBUG
|
||||
#ifdef LDEBUG
|
||||
cout << "G4HepRepSceneHandler::CloseHepRep() start" << endl;
|
||||
#endif
|
||||
|
||||
@@ -278,10 +283,21 @@ bool G4HepRepSceneHandler::closeHepRep(bool final) {
|
||||
// using DrawView() called from /vis/viewer/flush)
|
||||
if (_eventInstanceTree != NULL) {
|
||||
GetCurrentViewer()->DrawView();
|
||||
|
||||
// couple geometry to event if geometry was written
|
||||
if ((_geometryInstanceTree != NULL)) {
|
||||
getEventInstanceTree()->addInstanceTree(getGeometryInstanceTree());
|
||||
|
||||
// couple geometry
|
||||
if (messenger.appendGeometry()) {
|
||||
// couple geometry to event if geometry was written
|
||||
if ((_geometryInstanceTree != NULL)) {
|
||||
getEventInstanceTree()->addInstanceTree(getGeometryInstanceTree());
|
||||
}
|
||||
} else {
|
||||
char name[128];
|
||||
if (writeMultipleFiles) {
|
||||
sprintf(name, "%s%s%s#%s", baseName.c_str(), "-geometry", extension.c_str(), "G4GeometryData");
|
||||
} else {
|
||||
sprintf(name, "%s%s#%s", "geometry", ".heprep", "G4GeometryData");
|
||||
}
|
||||
getEventInstanceTree()->addInstanceTree(factory->createHepRepTreeID(name, "1.0"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,16 +312,31 @@ bool G4HepRepSceneHandler::closeHepRep(bool final) {
|
||||
|
||||
// Give this HepRep all of the layer order info for both geometry and event,
|
||||
// since these will both end up in a single HepRep.
|
||||
if (_geometryRootType != NULL) _heprep->addLayer(geometryLayer);
|
||||
if (_eventType != NULL) _heprep->addLayer(eventLayer);
|
||||
if (_calHitType != NULL) _heprep->addLayer(calHitLayer);
|
||||
if (_trajectoryType != NULL) _heprep->addLayer(trajectoryLayer);
|
||||
if (_hitType != NULL) _heprep->addLayer(hitLayer);
|
||||
writeLayers(_heprepGeometry);
|
||||
writeLayers(_heprep);
|
||||
|
||||
// open heprep file
|
||||
if (writer == NULL) {
|
||||
open((GetScene() == NULL) ? G4String("G4HepRepOutput.heprep.zip") : GetScene()->GetName());
|
||||
}
|
||||
|
||||
// write out separate geometry
|
||||
if (!messenger.appendGeometry() && (_heprepGeometry != NULL)) {
|
||||
if (writeMultipleFiles) {
|
||||
char fileName[128];
|
||||
sprintf(fileName, "%s%s%s", baseName.c_str(), "-geometry", extension.c_str());
|
||||
openFile(G4String(fileName));
|
||||
}
|
||||
|
||||
if (!writeMultipleFiles) writer->addProperty("RecordLoop.ignore", "geometry.heprep");
|
||||
|
||||
writer->write(_heprepGeometry, G4String("geometry.heprep"));
|
||||
|
||||
delete _heprepGeometry;
|
||||
_heprepGeometry = NULL;
|
||||
|
||||
if (writeMultipleFiles) closeFile();
|
||||
}
|
||||
|
||||
if (writeMultipleFiles) {
|
||||
// NOTE: does not work on Solaris 5.2 and Linux 2.95.2
|
||||
@@ -346,16 +377,19 @@ bool G4HepRepSceneHandler::closeHepRep(bool final) {
|
||||
|
||||
void G4HepRepSceneHandler::close() {
|
||||
|
||||
#ifdef SDEBUG
|
||||
#ifdef LDEBUG
|
||||
cout << "G4HepRepSceneHandler::Close() " << endl;
|
||||
#endif
|
||||
|
||||
if (writer == NULL) return;
|
||||
|
||||
|
||||
if (!writeMultipleFiles) {
|
||||
closeHepRep(true);
|
||||
closeFile();
|
||||
}
|
||||
|
||||
G4HepRepViewer* viewer = dynamic_cast<G4HepRepViewer*>(GetCurrentViewer());
|
||||
viewer->reset();
|
||||
}
|
||||
|
||||
void G4HepRepSceneHandler::openFile(G4String name) {
|
||||
@@ -372,6 +406,14 @@ void G4HepRepSceneHandler::closeFile() {
|
||||
out = NULL;
|
||||
}
|
||||
|
||||
void G4HepRepSceneHandler::writeLayers(HepRep* heprep) {
|
||||
if (heprep == NULL) return;
|
||||
heprep->addLayer(geometryLayer);
|
||||
heprep->addLayer(eventLayer);
|
||||
heprep->addLayer(calHitLayer);
|
||||
heprep->addLayer(trajectoryLayer);
|
||||
heprep->addLayer(hitLayer);
|
||||
}
|
||||
|
||||
void G4HepRepSceneHandler::EstablishSpecials(G4PhysicalVolumeModel& model) {
|
||||
#ifdef SDEBUG
|
||||
@@ -937,6 +979,43 @@ bool G4HepRepSceneHandler::isEventData () {
|
||||
return !currentPV || fReadyForTransients;
|
||||
}
|
||||
|
||||
void G4HepRepSceneHandler::addTopLevelAttributes(HepRepType* type) {
|
||||
|
||||
// Some non-standard attributes
|
||||
type->addAttDef( "Generator", "Generator of the file", "General", "");
|
||||
type->addAttValue("Generator", G4String("Geant4"));
|
||||
|
||||
type->addAttDef( "GeneratorVersion", "Version of the Generator", "General", "");
|
||||
type->addAttValue("GeneratorVersion", G4RunManagerKernel::GetRunManagerKernel()->GetVersionString());
|
||||
|
||||
type->addAttDef( "CoordinateSystem", "Coordinate System", "Draw", "");
|
||||
type->addAttValue("CoordinateSystem", messenger.getCoordinateSystem());
|
||||
|
||||
const G4ViewParameters parameters = GetCurrentViewer()->GetViewParameters();
|
||||
const G4Vector3D& viewPointDirection = parameters.GetViewpointDirection();
|
||||
type->addAttDef( "ViewTheta", "Theta of initial suggested viewpoint", "Draw", "rad");
|
||||
type->addAttValue("ViewTheta", viewPointDirection.theta());
|
||||
|
||||
type->addAttDef( "ViewPhi", "Phi of initial suggested viewpoint", "Draw", "rad");
|
||||
type->addAttValue("ViewPhi", viewPointDirection.phi());
|
||||
|
||||
type->addAttDef( "ViewScale", "Scale of initial suggested viewpoint", "Draw", "");
|
||||
type->addAttValue("ViewScale", parameters.GetZoomFactor());
|
||||
|
||||
// FIXME, no way to set these
|
||||
type->addAttDef( "ViewTranslateX", "Translate in X of initial suggested viewpoint", "Draw", "");
|
||||
type->addAttValue("ViewTranslateX", 0.0);
|
||||
|
||||
type->addAttDef( "ViewTranslateY", "Translate in Y of initial suggested viewpoint", "Draw", "");
|
||||
type->addAttValue("ViewTranslateY", 0.0);
|
||||
|
||||
type->addAttDef( "ViewTranslateZ", "Translate in Z of initial suggested viewpoint", "Draw", "");
|
||||
type->addAttValue("ViewTranslateZ", 0.0);
|
||||
|
||||
type->addAttDef( "PointUnit", "Length", "Physics", "");
|
||||
type->addAttValue("PointUnit", G4String("m"));
|
||||
}
|
||||
|
||||
HepRep* G4HepRepSceneHandler::getHepRep() {
|
||||
if (_heprep == NULL) {
|
||||
// Create the HepRep that holds the Trees.
|
||||
@@ -945,11 +1024,23 @@ HepRep* G4HepRepSceneHandler::getHepRep() {
|
||||
return _heprep;
|
||||
}
|
||||
|
||||
HepRep* G4HepRepSceneHandler::getHepRepGeometry() {
|
||||
if (_heprepGeometry == NULL) {
|
||||
// Create the HepRep that holds the Trees.
|
||||
_heprepGeometry = factory->createHepRep();
|
||||
}
|
||||
return _heprepGeometry;
|
||||
}
|
||||
|
||||
HepRepInstanceTree* G4HepRepSceneHandler::getGeometryInstanceTree() {
|
||||
if (_geometryInstanceTree == NULL) {
|
||||
// Create the Geometry InstanceTree.
|
||||
_geometryInstanceTree = factory->createHepRepInstanceTree("G4GeometryData", "1.0", getGeometryTypeTree());
|
||||
getHepRep()->addInstanceTree(_geometryInstanceTree);
|
||||
if (messenger.appendGeometry()) {
|
||||
getHepRep()->addInstanceTree(_geometryInstanceTree);
|
||||
} else {
|
||||
getHepRepGeometry()->addInstanceTree(_geometryInstanceTree);
|
||||
}
|
||||
}
|
||||
return _geometryInstanceTree;
|
||||
}
|
||||
@@ -965,12 +1056,14 @@ HepRepInstance* G4HepRepSceneHandler::getGeometryRootInstance() {
|
||||
HepRepInstance* G4HepRepSceneHandler::getGeometryInstance(G4LogicalVolume* volume, int depth) {
|
||||
HepRepInstance* instance = getGeometryInstance(volume->GetName(), depth);
|
||||
|
||||
setAttribute(instance, "LVol", volume->GetName());
|
||||
setAttribute(instance, "Solid", volume->GetSolid()->GetName());
|
||||
setAttribute(instance, "EType", volume->GetSolid()->GetEntityType());
|
||||
setAttribute(instance, "Material", volume->GetMaterial()->GetName());
|
||||
setAttribute(instance, "Density", volume->GetMaterial()->GetDensity());
|
||||
setAttribute(instance, "Radlen", volume->GetMaterial()->GetRadlen());
|
||||
setAttribute(instance, "LVol", volume->GetName());
|
||||
setAttribute(instance, "Region", volume->GetRegion()->GetName());
|
||||
setAttribute(instance, "RootRegion", volume->IsRootRegion());
|
||||
setAttribute(instance, "Solid", volume->GetSolid()->GetName());
|
||||
setAttribute(instance, "EType", volume->GetSolid()->GetEntityType());
|
||||
setAttribute(instance, "Material", volume->GetMaterial()->GetName());
|
||||
setAttribute(instance, "Density", volume->GetMaterial()->GetDensity());
|
||||
setAttribute(instance, "Radlen", volume->GetMaterial()->GetRadlen());
|
||||
|
||||
G4String state = materialState[volume->GetMaterial()->GetState()];
|
||||
setAttribute(instance, "State", state);
|
||||
@@ -1004,7 +1097,11 @@ HepRepTypeTree* G4HepRepSceneHandler::getGeometryTypeTree() {
|
||||
// Create the Geometry TypeTree.
|
||||
HepRepTreeID* geometryTreeID = factory->createHepRepTreeID("G4GeometryTypes", "1.0");
|
||||
_geometryTypeTree = factory->createHepRepTypeTree(geometryTreeID);
|
||||
getHepRep()->addTypeTree(_geometryTypeTree);
|
||||
if (messenger.appendGeometry()) {
|
||||
getHepRep()->addTypeTree(_geometryTypeTree);
|
||||
} else {
|
||||
getHepRepGeometry()->addTypeTree(_geometryTypeTree);
|
||||
}
|
||||
}
|
||||
return _geometryTypeTree;
|
||||
}
|
||||
@@ -1012,12 +1109,16 @@ HepRepTypeTree* G4HepRepSceneHandler::getGeometryTypeTree() {
|
||||
HepRepType* G4HepRepSceneHandler::getGeometryRootType() {
|
||||
if (_geometryRootType == NULL) {
|
||||
// Create the top level Geometry Type.
|
||||
_geometryRootType = factory->createHepRepType(NULL, rootVolumeName);
|
||||
_geometryRootType = factory->createHepRepType(getGeometryTypeTree(), rootVolumeName);
|
||||
_geometryRootType->addAttValue("Layer", geometryLayer);
|
||||
|
||||
// Add attdefs used by all geometry types.
|
||||
_geometryRootType->addAttDef ("LVol", "Logical Volume", "Physics","");
|
||||
_geometryRootType->addAttValue("LVol", G4String(""));
|
||||
_geometryRootType->addAttDef ("Region", "Cuts Region", "Physics","");
|
||||
_geometryRootType->addAttValue("Region", G4String(""));
|
||||
_geometryRootType->addAttDef ("RootRegion", "Root Region", "Physics","");
|
||||
_geometryRootType->addAttValue("RootRegion", false);
|
||||
_geometryRootType->addAttDef ("Solid", "Solid Name", "Physics","");
|
||||
_geometryRootType->addAttValue("Solid", G4String(""));
|
||||
_geometryRootType->addAttDef ("EType", "Entity Type", "Physics","");
|
||||
@@ -1042,9 +1143,9 @@ HepRepType* G4HepRepSceneHandler::getGeometryRootType() {
|
||||
|
||||
_geometryRootType->addAttValue("MarkSizeMultiplier", 4.0);
|
||||
_geometryRootType->addAttValue("LineWidthMultiplier", 1.0);
|
||||
|
||||
getGeometryTypeTree()->addType(_geometryRootType);
|
||||
|
||||
|
||||
addTopLevelAttributes(_geometryRootType);
|
||||
|
||||
_geometryType["/"+_geometryRootType->getName()] = _geometryRootType;
|
||||
}
|
||||
return _geometryRootType;
|
||||
@@ -1129,7 +1230,7 @@ HepRepTypeTree* G4HepRepSceneHandler::getEventTypeTree() {
|
||||
HepRepType* G4HepRepSceneHandler::getEventType() {
|
||||
if (_eventType == NULL) {
|
||||
// Create the top level Event Type.
|
||||
_eventType = factory->createHepRepType(NULL, "Event");
|
||||
_eventType = factory->createHepRepType(getEventTypeTree(), "Event");
|
||||
_eventType->addAttValue("Layer", eventLayer);
|
||||
|
||||
// add defaults for Events
|
||||
@@ -1144,11 +1245,7 @@ HepRepType* G4HepRepSceneHandler::getEventType() {
|
||||
_eventType->addAttValue("MarkSizeMultiplier", 4.0);
|
||||
_eventType->addAttValue("LineWidthMultiplier", 1.0);
|
||||
|
||||
// Some non-standard attributes
|
||||
_eventType->addAttDef("PointUnit", "Length", "Physics", "");
|
||||
_eventType->addAttValue("PointUnit", G4String("m"));
|
||||
|
||||
getEventTypeTree()->addType(_eventType);
|
||||
addTopLevelAttributes(_eventType);
|
||||
}
|
||||
|
||||
return _eventType;
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HepRepViewer.cc,v 1.22 2003/12/11 21:55:55 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4HepRepViewer.cc,v 1.25 2004/05/27 05:59:08 duns Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
|
||||
/**
|
||||
@@ -43,9 +43,10 @@
|
||||
using namespace HEPREP;
|
||||
using namespace std;
|
||||
|
||||
G4HepRepViewer::G4HepRepViewer (G4VSceneHandler& sceneHandler, const G4String& name)
|
||||
G4HepRepViewer::G4HepRepViewer (G4VSceneHandler& sceneHandler, G4HepRepMessenger& heprepMessenger, const G4String& name)
|
||||
: G4VViewer (sceneHandler, sceneHandler.IncrementViewCount(), name),
|
||||
geometryIncluded(false) {
|
||||
geometryIncluded(false),
|
||||
messenger(heprepMessenger) {
|
||||
|
||||
#ifdef SDEBUG
|
||||
cout << "G4HepRepViewer::G4HepRepViewer " << name << endl;
|
||||
@@ -106,7 +107,7 @@ void G4HepRepViewer::ShowView () {
|
||||
G4HepRepSceneHandler* sceneHandler = dynamic_cast<G4HepRepSceneHandler*>(GetSceneHandler());
|
||||
if (sceneHandler->closeHepRep()) {
|
||||
sceneHandler->openHepRep();
|
||||
geometryIncluded = false;
|
||||
if (messenger.appendGeometry()) geometryIncluded = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,3 +117,7 @@ void G4HepRepViewer::FinishView () {
|
||||
#endif
|
||||
G4VViewer::FinishView();
|
||||
}
|
||||
|
||||
void G4HepRepViewer::reset() {
|
||||
geometryIncluded = false;
|
||||
}
|
||||
|
||||
@@ -37,9 +37,22 @@ XMLHepRepWriter::~XMLHepRepWriter() {
|
||||
delete xml;
|
||||
}
|
||||
|
||||
bool XMLHepRepWriter::addProperty(std::string key, std::string value) {
|
||||
properties[key] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool XMLHepRepWriter::close() {
|
||||
xml->closeDoc(true);
|
||||
if (zip != NULL) {
|
||||
zip->putNextEntry(ZipCDirEntry("heprep.properties"));
|
||||
|
||||
map<string, string>::iterator i = properties.begin();
|
||||
while (i != properties.end()) {
|
||||
*zip << (*i).first << "=" << (*i).second << endl;
|
||||
i++;
|
||||
}
|
||||
zip->closeEntry();
|
||||
zip->finish();
|
||||
zip->close();
|
||||
}
|
||||
@@ -58,15 +71,15 @@ bool XMLHepRepWriter::write(HepRep* heprep, string name) {
|
||||
xml->openDoc();
|
||||
xml->setAttribute("xmlns", "http://java.freehep.org/schemas/heprep/2.0");
|
||||
xml->setAttribute("xmlns", "xsi", "http://www.w3.org/2001/XMLSchema-instance");
|
||||
xml->setAttribute("xsi", "schemaLocation", "HepRep.xsd");
|
||||
xml->setAttribute("xsi", "schemaLocation", "http://java.freehep.org/schemas/heprep/2.0 http://java.freehep.org/schemas/heprep/2.0/HepRep.xsd");
|
||||
xml->openTag(nameSpace, "heprep");
|
||||
write(heprep->getLayerOrder());
|
||||
vector<HepRepTypeTree*>* typeTreeList = heprep->getTypeTrees();
|
||||
for (vector<HepRepTypeTree*>::iterator i1=typeTreeList->begin(); i1 != typeTreeList->end(); i1++) {
|
||||
set<HepRepTypeTree*> typeTreeSet = heprep->getTypeTrees();
|
||||
for (set<HepRepTypeTree*>::iterator i1=typeTreeSet.begin(); i1 != typeTreeSet.end(); i1++) {
|
||||
write(*i1);
|
||||
}
|
||||
vector<HepRepInstanceTree*>* instanceTreeList = heprep->getInstanceTrees();
|
||||
for (vector<HepRepInstanceTree*>::iterator i2=instanceTreeList->begin(); i2 != instanceTreeList->end(); i2++) {
|
||||
set<HepRepInstanceTree*> instanceTreeSet = heprep->getInstanceTrees();
|
||||
for (set<HepRepInstanceTree*>::iterator i2=instanceTreeSet.begin(); i2 != instanceTreeSet.end(); i2++) {
|
||||
write(*i2);
|
||||
}
|
||||
xml->closeTag();
|
||||
@@ -78,10 +91,10 @@ bool XMLHepRepWriter::write(HepRep* heprep, string name) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool XMLHepRepWriter::write(vector<string> *layers) {
|
||||
bool XMLHepRepWriter::write(vector<string> layers) {
|
||||
string layerOrder = "";
|
||||
bool comma = false;
|
||||
for (vector<string>::iterator i=layers->begin(); i != layers->end(); i++) {
|
||||
for (vector<string>::iterator i=layers.begin(); i != layers.end(); i++) {
|
||||
if (comma) {
|
||||
layerOrder.append(", ");
|
||||
}
|
||||
@@ -98,8 +111,8 @@ bool XMLHepRepWriter::write(HepRepTypeTree* typeTree) {
|
||||
xml->setAttribute("version", typeTree->getVersion());
|
||||
xml->openTag(nameSpace, "typetree");
|
||||
|
||||
vector<HepRepType*>* list = typeTree->getTypes();
|
||||
for (vector<HepRepType*>::iterator i=list->begin(); i != list->end(); i++) {
|
||||
set<HepRepType*> types = typeTree->getTypes();
|
||||
for (set<HepRepType*>::iterator i=types.begin(); i != types.end(); i++) {
|
||||
write(*i);
|
||||
}
|
||||
xml->closeTag();
|
||||
@@ -112,8 +125,8 @@ bool XMLHepRepWriter::write(HepRepType* type) {
|
||||
write((HepRepDefinition*)type);
|
||||
write((HepRepAttribute*)type);
|
||||
|
||||
vector<HepRepType*>* list = type->getTypes();
|
||||
for (vector<HepRepType*>::iterator i=list->begin(); i != list->end(); i++) {
|
||||
set<HepRepType*> types = type->getTypes();
|
||||
for (set<HepRepType*>::iterator i=types.begin(); i != types.end(); i++) {
|
||||
write(*i);
|
||||
}
|
||||
xml->closeTag();
|
||||
@@ -142,14 +155,14 @@ bool XMLHepRepWriter::write(HepRepInstanceTree* instanceTree) {
|
||||
xml->setAttribute("typetreeversion", instanceTree->getTypeTree()->getVersion());
|
||||
xml->openTag(nameSpace, "instancetree");
|
||||
// refs
|
||||
vector<HepRepTreeID*>* instanceTreeList = instanceTree->getInstanceTrees();
|
||||
for (vector<HepRepTreeID*>::iterator i1=instanceTreeList->begin(); i1 != instanceTreeList->end(); i1++) {
|
||||
set<HepRepTreeID*> instanceTreeSet = instanceTree->getInstanceTrees();
|
||||
for (set<HepRepTreeID*>::iterator i1=instanceTreeSet.begin(); i1 != instanceTreeSet.end(); i1++) {
|
||||
write(*i1);
|
||||
}
|
||||
|
||||
// instances
|
||||
vector<HepRepInstance*>* instanceList = instanceTree->getInstances();
|
||||
for (vector<HepRepInstance*>::iterator i2=instanceList->begin(); i2 != instanceList->end(); i2++) {
|
||||
vector<HepRepInstance*> instanceList = instanceTree->getInstances();
|
||||
for (vector<HepRepInstance*>::iterator i2=instanceList.begin(); i2 != instanceList.end(); i2++) {
|
||||
write(*i2);
|
||||
}
|
||||
xml->closeTag();
|
||||
@@ -162,13 +175,13 @@ bool XMLHepRepWriter::write(HepRepInstance* instance) {
|
||||
xml->openTag(nameSpace, "instance");
|
||||
write((HepRepAttribute*)instance);
|
||||
|
||||
vector<HepRepPoint*>* pointList = instance->getPoints();
|
||||
for (vector<HepRepPoint*>::iterator i1=pointList->begin(); i1 != pointList->end(); i1++) {
|
||||
vector<HepRepPoint*> pointList = instance->getPoints();
|
||||
for (vector<HepRepPoint*>::iterator i1=pointList.begin(); i1 != pointList.end(); i1++) {
|
||||
write(*i1);
|
||||
}
|
||||
|
||||
vector<HepRepInstance*>* instanceList = instance->getInstances();
|
||||
for (vector<HepRepInstance*>::iterator i2=instanceList->begin(); i2 != instanceList->end(); i2++) {
|
||||
vector<HepRepInstance*> instanceList = instance->getInstances();
|
||||
for (vector<HepRepInstance*>::iterator i2=instanceList.begin(); i2 != instanceList.end(); i2++) {
|
||||
write(*i2);
|
||||
}
|
||||
xml->closeTag();
|
||||
@@ -179,7 +192,7 @@ bool XMLHepRepWriter::write(HepRepPoint* point) {
|
||||
xml->setAttribute("x", point->getX());
|
||||
xml->setAttribute("y", point->getY());
|
||||
xml->setAttribute("z", point->getZ());
|
||||
if (point->getAttValuesFromNode()->size() != 0) {
|
||||
if (point->getAttValuesFromNode().size() != 0) {
|
||||
xml->openTag(nameSpace, "point");
|
||||
write((HepRepAttribute*)point);
|
||||
xml->closeTag();
|
||||
@@ -195,16 +208,16 @@ bool XMLHepRepWriter::write(HepRepAttribute* attribute) {
|
||||
HepRepAttValue* layerAtt = attribute->getAttValueFromNode("layer");
|
||||
if (layerAtt != NULL) write(layerAtt);
|
||||
|
||||
vector<HepRepAttValue*>* list = attribute->getAttValuesFromNode();
|
||||
for (vector<HepRepAttValue*>::iterator i=list->begin(); i != list->end(); i++) {
|
||||
set<HepRepAttValue*> attSet = attribute->getAttValuesFromNode();
|
||||
for (set<HepRepAttValue*>::iterator i=attSet.begin(); i != attSet.end(); i++) {
|
||||
write(*i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool XMLHepRepWriter::write(HepRepDefinition* definition) {
|
||||
vector<HepRepAttDef*>* list = definition->getAttDefsFromNode();
|
||||
for (vector<HepRepAttDef*>::iterator i=list->begin(); i != list->end(); i++) {
|
||||
set<HepRepAttDef*> list = definition->getAttDefsFromNode();
|
||||
for (set<HepRepAttDef*>::iterator i=list.begin(); i != list.end(); i++) {
|
||||
write(*i);
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user