Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eclipse Projects
The Eclipse Integrated Computational Environment
ice
Commits
b0c8f5f6
Commit
b0c8f5f6
authored
Jul 17, 2015
by
Robert Smith
Browse files
Revert "Revert "Added geometry bundle""
This reverts commit
4a1b863c
.
parent
4a1b863c
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/org.eclipse.ice.viz.service.geometry/.classpath
0 → 100644
View file @
b0c8f5f6
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.pde.core.requiredPlugins"
/>
<classpathentry
kind=
"src"
path=
"src"
/>
<classpathentry
kind=
"output"
path=
"bin"
/>
</classpath>
src/org.eclipse.ice.viz.service.geometry/.gitignore
0 → 100644
View file @
b0c8f5f6
/bin
/target
src/org.eclipse.ice.viz.service.geometry/.project
0 → 100644
View file @
b0c8f5f6
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
org.eclipse.ice.viz.service.geometry
</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>
org.eclipse.jdt.core.javabuilder
</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.pde.ManifestBuilder
</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.pde.SchemaBuilder
</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.pde.ds.core.builder
</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>
org.eclipse.pde.PluginNature
</nature>
<nature>
org.eclipse.jdt.core.javanature
</nature>
</natures>
</projectDescription>
src/org.eclipse.ice.viz.service.geometry/.settings/org.eclipse.jdt.core.prefs
0 → 100644
View file @
b0c8f5f6
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
src/org.eclipse.ice.viz.service.geometry/META-INF/MANIFEST.MF
0 → 100644
View file @
b0c8f5f6
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: VisIt Visualization Service Plugin
Bundle-SymbolicName: org.eclipse.ice.viz.service.geometry;singleton:=true
Bundle-Version: 2.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: gov.lbnl.visit.swt,
gov.lbnl.visit.swt.widgets,
org.eclipse.ice.datastructures.ICEObject,
org.eclipse.ice.datastructures.componentVisitor,
org.eclipse.ice.datastructures.form.geometry,
org.slf4j;version="1.7.2",
visit.java.client
Export-Package: org.eclipse.ice.viz.service.geometry
Service-Component: OSGI-INF/vizService.xml
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui
Bundle-Vendor: Oak Ridge National Laboratory
src/org.eclipse.ice.viz.service.geometry/build.properties
0 → 100644
View file @
b0c8f5f6
output..
=
bin/
bin.includes
=
META-INF/,
\
.,
\
plugin.xml,
\
icons/,
\
OSGI-INF/,
\
OSGI-INF/vizService.xml
source..
=
src/
src/org.eclipse.ice.viz.service.geometry/plugin.xml
0 → 100644
View file @
b0c8f5f6
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
</plugin>
src/org.eclipse.ice.viz.service.geometry/pom.xml
0 → 100644
View file @
b0c8f5f6
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
ICE
</groupId>
<artifactId>
org.eclipse.ice.build
</artifactId>
<version>
2.0.0
</version>
<relativePath>
${pom-filename}
</relativePath>
</parent>
<groupId>
ICE
</groupId>
<artifactId>
org.eclipse.ice.viz.service.geometry
</artifactId>
<version>
2.0.0
</version>
<packaging>
eclipse-plugin
</packaging>
</project>
\ No newline at end of file
src/org.eclipse.ice.viz.service.geometry/src/org/eclipse/ice/viz/service/geometry/Geometry.java
0 → 100644
View file @
b0c8f5f6
/*******************************************************************************
* Copyright (c) 2015 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Initial API and implementation and/or initial documentation - Jay Jay Billings,
* Jordan H. Deyton, Dasha Gorin, Alexander J. McCaskey, Taylor Patterson,
* Claire Saunders, Matthew Wang, Anna Wojtowicz, Robert Smith
*******************************************************************************/
package
org.eclipse.ice.viz.service.geometry
;
import
java.util.ArrayList
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAnyElement
;
import
javax.xml.bind.annotation.XmlElementRef
;
import
javax.xml.bind.annotation.XmlElementRefs
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
javax.xml.bind.annotation.XmlTransient
;
import
org.eclipse.ice.datastructures.ICEObject.IUpdateable
;
import
org.eclipse.ice.datastructures.ICEObject.IUpdateableListener
;
import
org.eclipse.ice.datastructures.form.geometry.AbstractGeometry
;
import
org.eclipse.ice.datastructures.form.geometry.ComplexShape
;
import
org.eclipse.ice.datastructures.form.geometry.IShape
;
import
org.eclipse.ice.datastructures.form.geometry.PrimitiveShape
;
/**
* A class which manages a collection of shapes for its parent
* GeometryComponent. It is registered as a listener for each IShape and the
* parent GeometryComponent is registered as a listener of this class.
*
* @author Robert Smith
*
*/
@XmlRootElement
(
name
=
"Geometry"
)
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
Geometry
extends
AbstractGeometry
implements
IUpdateable
,
IUpdateableListener
{
/**
* <p>
* The list of shapes referenced by the GeometryComponent container
* </p>
*
*/
@XmlAnyElement
()
@XmlElementRefs
(
value
=
{
@XmlElementRef
(
name
=
"ComplexShape"
,
type
=
ComplexShape
.
class
),
@XmlElementRef
(
name
=
"PrimitiveShape"
,
type
=
PrimitiveShape
.
class
)
})
private
ArrayList
<
IShape
>
shapes
;
/**
* The list of objects registered as listeners to this one.
*/
@XmlTransient
private
ArrayList
<
IUpdateableListener
>
listeners
;
/**
* The IUpdateable description
*/
String
description
;
/**
* The IUpdateable ID
*/
int
id
;
/**
* The IUpdateable name
*/
String
name
;
/**
* <p>
* Creates empty lists of IShapes and IUpdateableListeners
* </p>
*
*/
public
Geometry
()
{
// Create new shapes and listeners lists
shapes
=
new
ArrayList
<
IShape
>();
listeners
=
new
ArrayList
<
IUpdateableListener
>();
}
/**
* <p>
* Adds an IShape to the shape list
* </p>
*
* @param shape
* <p>
* The new shape to be added to the existing list
* </p>
*/
@Override
public
void
addShape
(
IShape
shape
)
{
// Ignore null
if
(
shape
==
null
)
{
return
;
}
// Register the parent GeometryComponent as a listener
shape
.
register
(
this
);
// Add the shape to the shapes list
shapes
.
add
(
shape
);
// Notify the listeners
update
(
shape
);
}
/**
* <p>
* Removes the given IShape if it exists in the shape list
* </p>
*
* @param shape
* <p>
* The IShape reference to be removed from the shapes list
* </p>
*/
@Override
public
void
removeShape
(
IShape
shape
)
{
// Ignore null
if
(
shape
==
null
)
{
return
;
}
// Remove the shape from the shapes list if it exists
if
(
shapes
.
remove
(
shape
))
{
// Notify listeners if a change was made
update
(
shape
);
}
}
/**
* <p>
* Returns a list of all IShapes stored in the shapes list
* </p>
*
* @return <p>
* The list of shapes contained in this GeometryComponent container
* </p>
*/
@Override
public
ArrayList
<
IShape
>
getShapes
()
{
// Simply return a reference to the shapes list
return
this
.
shapes
;
}
/**
*
* @param shapes
* <p>
* The shapes list to replace the existing shapes list
* </p>
*/
@Override
public
void
setShapes
(
ArrayList
<
IShape
>
shapes
)
{
// If null, quietly fail
if
(
shapes
==
null
)
{
return
;
}
// Tracks whether the parent component needs to be alerted to a change
boolean
updateComponent
=
false
;
// If shapes were already present, there has been a change
if
(
shapes
.
size
()
>
0
)
{
updateComponent
=
true
;
}
// Replace the reference to the shapes list
this
.
shapes
=
shapes
;
for
(
IShape
shape
:
shapes
)
{
shape
.
register
(
this
);
// At least one shape has been added
updateComponent
=
true
;
}
// A change has been made, notify the listeners
if
(
updateComponent
)
{
update
(
new
PrimitiveShape
());
}
}
/**
* <p>
* This operation returns the hashcode value of the GeometryComponent.
* </p>
*
* @return <p>
* The hashcode of the ICEObject.
* </p>
*/
@Override
public
int
hashCode
()
{
// Start with the ICEObject's hashcode
int
hash
=
super
.
hashCode
();
// Hash the list
for
(
IShape
shape
:
shapes
)
{
hash
=
31
*
hash
+
shape
.
hashCode
();
}
return
hash
;
}
/**
* <p>
* This operation is used to check equality between this GeometryComponent
* and another GeometryComponent. It returns true if the GeometryComponents
* are equal and false if they are not.
* </p>
*
* @param otherObject
* <p>
* The other ICEObject that should be compared with this one.
* </p>
* @return <p>
* True if the ICEObjects are equal, false otherwise.
* </p>
*/
@Override
public
boolean
equals
(
Object
otherObject
)
{
// Check if a similar reference
if
(
this
==
otherObject
)
{
return
true
;
}
// Check that the other object is not null and an instance of the
// GeometryComponent
if
(
otherObject
==
null
||
!(
otherObject
instanceof
Geometry
))
{
return
false
;
}
// At this point, other object must be a PrimitiveShape, so cast it
Geometry
geometry
=
(
Geometry
)
otherObject
;
// Check for equal number of shapes in shapes list
if
(
this
.
shapes
.
size
()
!=
geometry
.
shapes
.
size
())
{
return
false
;
}
// Check for equal elements in shapes list
// The list must be ordered similarly for this test to pass.
int
numShapes
=
shapes
.
size
();
for
(
int
index
=
0
;
index
<
numShapes
;
index
++)
{
// Check for equal shapes in the current index
if
(!
shapes
.
get
(
index
).
equals
(
geometry
.
shapes
.
get
(
index
)))
{
return
false
;
}
}
// The two shapes are equal
return
true
;
}
/**
* <p>
* This operation copies the contents of a GeometryComponent into the
* current object using a deep copy.
* </p>
*
* @param iceObject
* <p>
* The ICEObject from which the values should be copied
* </p>
*/
public
void
copy
(
Geometry
iceObject
)
{
// Return if object is null
if
(
iceObject
==
null
)
{
return
;
}
// Copy listeners list
this
.
listeners
.
clear
();
for
(
IUpdateableListener
listener
:
iceObject
.
listeners
)
{
this
.
listeners
.
add
(
listener
);
}
// Tracks whether the parent component needs to be alerted to a change
boolean
updateComponent
=
false
;
// If there were shapes that will be overwritten, a change has been made
if
(
shapes
.
size
()
>
0
)
{
updateComponent
=
true
;
}
// Copy shapes list
this
.
shapes
.
clear
();
for
(
IShape
shape
:
iceObject
.
shapes
)
{
this
.
shapes
.
add
((
IShape
)
shape
.
clone
());
// At least one shape has been added
updateComponent
=
true
;
}
// A change has been made, notify the listeners
if
(
updateComponent
)
{
update
(
new
PrimitiveShape
());
}
}
/**
* <p>
* This operation returns a clone of the GeometryComponent using a deep
* copy.
* </p>
*
* @return <p>
* The new clone
* </p>
*/
@Override
public
Object
clone
()
{
// Instantiate GeometryComponent
Geometry
geometry
=
new
Geometry
();
// Return the copied GeometryComponent
geometry
.
copy
(
this
);
return
geometry
;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.datastructures.ICEObject.IUpdateableListener#update(org
* .eclipse.ice.datastructures.ICEObject.IUpdateable)
*/
@Override
public
void
update
(
IUpdateable
component
)
{
final
Geometry
geometry
=
this
;
// If the listeners are empty, return
if
(
this
.
listeners
==
null
||
this
.
listeners
.
isEmpty
())
{
return
;
}
// Create a thread object that notifies all listeners
Thread
notifyThread
=
new
Thread
()
{
@Override
public
void
run
()
{
// Loop over all listeners and update them
for
(
int
i
=
0
;
i
<
listeners
.
size
();
i
++)
{
listeners
.
get
(
i
).
update
(
geometry
);
}
}
};
// Start the thread
notifyThread
.
start
();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ice.datastructures.ICEObject.Identifiable#setId(int)
*/
@Override
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.datastructures.ICEObject.Identifiable#getDescription()
*/
@Override
public
String
getDescription
()
{
return
description
;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ice.datastructures.ICEObject.Identifiable#getId()
*/
@Override
public
int
getId
()
{
return
id
;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.datastructures.ICEObject.Identifiable#setName(java.lang
* .String)
*/
@Override
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ice.datastructures.ICEObject.Identifiable#getName()
*/
@Override
public
String
getName
()
{
return
name
;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.datastructures.ICEObject.Identifiable#setDescription(
* java.lang.String)
*/
@Override
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.datastructures.ICEObject.IUpdateable#update(java.lang
* .String, java.lang.String)
*/
@Override
public
void
update
(
String
updatedKey
,
String
newValue
)
{
// Not implemented
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.datastructures.ICEObject.IUpdateable#register(org.eclipse
* .ice.datastructures.ICEObject.IUpdateableListener)
*/
@Override
public
void
register
(
IUpdateableListener
listener
)
{
listeners
.
add
(
listener
);
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.datastructures.ICEObject.IUpdateable#unregister(org.eclipse
* .ice.datastructures.ICEObject.IUpdateableListener)