Skip to content

Commit

Permalink
Merge branch '15-reset-version-and-update-group-id-for-github-deploym…
Browse files Browse the repository at this point in the history
…ent' into 'main'

Resolve "Reset version and update group ID for GitHub deployment"

Closes #15

See merge request sbmt/sbmt-model!6
joshsteeleAPL committed Sep 27, 2024
2 parents a18750c + fe538c7 commit 2397d7a
Showing 12 changed files with 335 additions and 131 deletions.
10 changes: 9 additions & 1 deletion .classpath
Original file line number Diff line number Diff line change
@@ -6,8 +6,16 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-16">
<classpathentry kind="src" output="target/test-classes" path="test">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
30 changes: 30 additions & 0 deletions .github/workflows/maven-central-deploy-on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish package to the Maven Central Repository
on:
release:
types: [created]
workflow_dispatch:

jobs:
publish:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Publish package
run: mvn --batch-mode clean deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
41 changes: 41 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI with Maven

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Build and verify with Maven only
run: mvn -B verify --file pom.xml
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6


2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ stages:
variables:
JAVA_HOME: "/opt/openjdk17" # Sets Java version to run (see /opt for details)
# Sets the artifact cache to a local directory within build area
MAVEN_CLI_OPTS: "-Dmaven.repo.local=../.m2/repository --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN"
MAVEN_CLI_OPTS: "-Dmaven.repo.local=../.m2/repository --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -P internal"

#Workflow rules that filters across the entire pipeline. Cleaner than -o ci.skip since there won't be a "skipped" pipeline.
workflow:
1 change: 1 addition & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
encoding/src=UTF-8
encoding/test=UTF-8
6 changes: 3 additions & 3 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=16
org.eclipse.jdt.core.compiler.compliance=16
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=16
org.eclipse.jdt.core.compiler.source=17
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Contributing

We welcome pull requests on this project. However, due to funding constraints, there is no guarantee that pull requests will be merged with the main line code or even reviewed. We will do the best we can.

To contribute: fork, then clone the repo:

```
git clone git@github.com:your-username/sbmt-model.git
```

Make your changes, and push them to your fork. Then submit a pull request.

Things that will help increase that your pull request is reviewed and accepted:

- Write tests (and make sure they pass!)
- Write a [good commit message](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright 2024 Johns Hopkins University Applied Physics Laboratory, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# sbmt-model

![GitHub last commit](https://img.shields.io/github/last-commit/NASA-Planetary-Science/sbmt-model)

sbmt-model is a library for the overall [SBMT family of libraries](https://github.com/orgs/NASA-Planetary-Science/teams/sbmt/repositories). It contains classes for dealing with special model cases that are used in the tool.

## Usage

sbmt-model is intended as a dependency for other libraries in the SBMT family. You can either clone this library by itself, or use the [Eclipse project team set file](https://github.com/orgs/NASA-Planetary-Science/teams/sbmt/repositories/sbmt-overview/teamProjectSet.psf) located in the [sbmt-overview](https://github.com/orgs/NASA-Planetary-Science/teams/sbmt/repositories/sbmt-overview) to pull down the entire family of libraries into an Eclipse workspace.

sbmt-model is available as a jar at [Maven Central](https://central.sonatype.com/artifact/edu.jhuapl.ses/sbmt-model). The dependency listing is:

```
<dependency>
<groupId>edu.jhuapl.ses.sbmt</groupId>
<artifactId>sbmt-model</artifactId>
<version>1.0.0</version>
</dependency>
```


## Contributing

Please see the [Contributing](Contributing.md) file for information. Pull requests will be reviewed and merged on a best-effort basis; there are no guarantees, due to funding restrictions.

## Code of Conduct

The SBMT family of libraries all support the [Github Code of Conduct](https://docs.github.com/en/site-policy/github-terms/github-community-code-of-conduct).

196 changes: 131 additions & 65 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,66 +1,132 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>edu.jhuapl.ses.srn.sbmt</groupId>
<artifactId>sbmt-model</artifactId>
<version>1.0.8-b3-SNAPSHOT</version>
<name>sbmt-model</name>
<description>SBMT model configurations</description>
<packaging>jar</packaging>
<organization>
<name>Johns Hopkins University Applied Physics Lab</name>
<url>https://www.jhuapl.edu</url>
</organization>
<distributionManagement>
<repository>
<id>central</id>
<name>surfshop-releases</name>
<url>http://surfshop.jhuapl.edu:8081/artifactory/libs-release-local</url>
</repository>
<snapshotRepository>
<id>central</id>
<name>surfshop-snapshots</name>
<url>http://surfshop.jhuapl.edu:8081/artifactory/libs-snapshot-local</url>
</snapshotRepository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>edu.jhuapl.ses.srn.sbmt</groupId>
<artifactId>sbmt-dem</artifactId>
<version>1.0.9</version>
</dependency>
<dependency>
<groupId>edu.jhuapl.ses.srn.sbmt</groupId>
<artifactId>sbmt-stateHistory</artifactId>
<version>1.0.8-b3-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>16</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>sbmt-model</artifactId>
<version>1.0.0</version>
<name>sbmt-model</name>
<description>SBMT model configurations</description>
<packaging>jar</packaging>

<parent>
<groupId>edu.jhuapl.ses.sbmt</groupId>
<artifactId>sbmt-overview</artifactId>
<version>1.0.0</version>
</parent>

<url>https://github.com/NASA-Planetary-Science/sbmt-model</url>

<scm>
<connection>
scm:git:https://github.com/NASA-Planetary-Science/sbmt-model.git</connection>
<url>
https://github.com/NASA-Planetary-Science/sbmt-model.git</url>
<developerConnection>
scm:git:https://github.com/NASA-Planetary-Science/sbmt-model.git</developerConnection>
<tag>HEAD</tag>
</scm>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>

<profiles>
<profile>
<id>internal</id>
<distributionManagement>
<repository>
<id>central</id>
<name>surfshop-releases</name>
<url>
http://surfshop.jhuapl.edu:8081/artifactory/libs-release-local</url>
</repository>
<snapshotRepository>
<id>central</id>
<name>surfshop-snapshots</name>
<url>
http://surfshop.jhuapl.edu:8081/artifactory/libs-snapshot-local</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>github-build</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>edu.jhuapl.ses.sbmt</groupId>
<artifactId>sbmt-dem</artifactId>
</dependency>
<dependency>
<groupId>edu.jhuapl.ses.sbmt</groupId>
<artifactId>sbmt-stateHistory</artifactId>
</dependency>
</dependencies>

</project>
92 changes: 31 additions & 61 deletions src/edu/jhuapl/sbmt/model/BaseView.java
Original file line number Diff line number Diff line change
@@ -52,6 +52,8 @@
import edu.jhuapl.sbmt.dem.gui.DemMainPanel;
import edu.jhuapl.sbmt.image.config.ImagingInstrumentConfig;
import edu.jhuapl.sbmt.image.controllers.ImageSearchController;
import edu.jhuapl.sbmt.image.interfaces.IPerspectiveImage;
import edu.jhuapl.sbmt.image.interfaces.IPerspectiveImageTableRepresentable;
import edu.jhuapl.sbmt.image.model.BasemapImageCollection;
import edu.jhuapl.sbmt.image.model.ImagingInstrument;
import edu.jhuapl.sbmt.image.model.PerspectiveImageCollection;
@@ -100,14 +102,13 @@ public abstract class BaseView extends View implements PropertyChangeListener
private static final long serialVersionUID = 1L;
protected final TrackedMetadataManager stateManager;
protected final Map<String, MetadataManager> metadataManagers;
// protected Colorbar smallBodyColorbar;
protected BasicConfigInfo configInfo;
private List<SmallBodyModel> smallBodyModels;
protected HashMap<ModelNames, List<Model>> allModels = new HashMap<>();
private StateHistoryRendererManager rendererManager;
private List<PositionOrientationManagerListener> pomListeners;

// need to move to phobos/megane
// TODO need to move to phobos/megane (model layer)
private MEGANECollection meganeCollection;
private CumulativeMEGANECollection cumulativeMeganeCollection;

@@ -151,7 +152,6 @@ protected void initialize() throws InvocationTargetException, InterruptedExcepti
setConfig(SmallBodyViewConfig.getSmallBodyConfig(configInfo));
}

// TODO Auto-generated method stub
super.initialize();
}

@@ -297,16 +297,12 @@ protected void setupModelManager()

getModelManager().addPropertyChangeListener(this);

// SBMTInfoWindowManagerFactory.initializeModels(getModelManager(), getLegacyStatusHandler());

tmpSceneChangeNotifier.setTarget(getModelManager());

}

protected void setupBodyModels()
{
smallBodyModels = SbmtModelFactory.createSmallBodyModels(getPolyhedralModelConfig());
// allModels.put(ModelNames.SMALL_BODY, smallBodyModel);
List<Model> allBodies = Lists.newArrayList();
allBodies.addAll(smallBodyModels);
allModels.put(ModelNames.SMALL_BODY, allBodies);
@@ -318,33 +314,33 @@ protected void setupStructureModels(SceneChangeNotifier aSceneChangeNotifier, St
structureManager = new AnyStructureManager(aSceneChangeNotifier, aStatusNotifier, smallBodyModel);
}

protected void setupSpectraModels(ConfigurableSceneNotifier tmpSceneChangeNotifier)
protected <S extends BasicSpectrum> void setupSpectraModels(ConfigurableSceneNotifier tmpSceneChangeNotifier)
{
SmallBodyModel smallBodyModel = smallBodyModels.get(0);
HashMap<ModelNames, List<Model>> models = new HashMap<ModelNames, List<Model>>();

ShapeModelBody body = ((SmallBodyViewConfig) smallBodyModel.getConfig()).body;
ShapeModelType author = ((SmallBodyViewConfig) smallBodyModel.getConfig()).author;
String version = ((SmallBodyViewConfig) smallBodyModel.getConfig()).version;
// ShapeModelBody body = ((SmallBodyViewConfig) smallBodyModel.getConfig()).body;
// ShapeModelType author = ((SmallBodyViewConfig) smallBodyModel.getConfig()).author;
// String version = ((SmallBodyViewConfig) smallBodyModel.getConfig()).version;

// TODO FIX THIS
// models.put(ModelNames.SPECTRA_HYPERTREE_SEARCH, new
// SpectraSearchDataCollection(smallBodyModel));

SpectraCollection collection = new SpectraCollection(tmpSceneChangeNotifier, smallBodyModel);
SpectraCollection<S> collection = new SpectraCollection<S>(tmpSceneChangeNotifier, smallBodyModel);

models.put(ModelNames.SPECTRA, List.of(collection));

allModels.putAll(models);
allModels.put(ModelNames.SPECTRA_BOUNDARIES, List.of(new SpectrumBoundaryCollection(smallBodyModel,
(SpectraCollection) allModels.get(ModelNames.SPECTRA).get(0))));
allModels.put(ModelNames.SPECTRA_BOUNDARIES, List.of(new SpectrumBoundaryCollection<S>(smallBodyModel,
(SpectraCollection<S>) allModels.get(ModelNames.SPECTRA).get(0))));
// if (getPolyhedralModelConfig().body == ShapeModelBody.EROS)
allModels.put(ModelNames.STATISTICS, List.of(new SpectrumStatisticsCollection()));

SpectraCollection customCollection = new SpectraCollection(tmpSceneChangeNotifier, smallBodyModel);
SpectraCollection<S> customCollection = new SpectraCollection<S>(tmpSceneChangeNotifier, smallBodyModel);
allModels.put(ModelNames.CUSTOM_SPECTRA, List.of(customCollection));
allModels.put(ModelNames.CUSTOM_SPECTRA_BOUNDARIES, List.of(new SpectrumBoundaryCollection(smallBodyModel,
(SpectraCollection) allModels.get(ModelNames.CUSTOM_SPECTRA).get(0))));
allModels.put(ModelNames.CUSTOM_SPECTRA_BOUNDARIES, List.of(new SpectrumBoundaryCollection<S>(smallBodyModel,
(SpectraCollection<S>) allModels.get(ModelNames.CUSTOM_SPECTRA).get(0))));

// TODO add this to phobox/megane setup
// if (!getPolyhedralModelConfig().spectralInstruments.stream().filter(inst ->
@@ -358,9 +354,9 @@ protected void setupSpectraModels(ConfigurableSceneNotifier tmpSceneChangeNotifi
// }
}

protected void setupImagerModel()
protected <G1 extends IPerspectiveImage & IPerspectiveImageTableRepresentable> void setupImagerModel()
{
allModels.put(ModelNames.IMAGES_V2, List.of(new PerspectiveImageCollection(smallBodyModels)));
allModels.put(ModelNames.IMAGES_V2, List.of(new PerspectiveImageCollection<G1>(smallBodyModels)));
allModels.put(ModelNames.BASEMAPS, List.of(new BasemapImageCollection<>(smallBodyModels)));
}

@@ -531,16 +527,16 @@ protected void setupModelTab()

}

protected void setupNormalImagingTabs()
protected <G1 extends IPerspectiveImage & IPerspectiveImageTableRepresentable> void setupNormalImagingTabs()
{
PerspectiveImageCollection collection = (PerspectiveImageCollection) getModelManager()
PerspectiveImageCollection<G1> collection = (PerspectiveImageCollection<G1>) getModelManager()
.getModel(ModelNames.IMAGES_V2);

List<IFeatureConfig> imagingConfigs = getPolyhedralModelConfig()
.getConfigsForClass(ImagingInstrumentConfig.class);
if (imagingConfigs == null)
{
ImageSearchController cont = new ImageSearchController(null, collection,
ImageSearchController<G1> cont = new ImageSearchController<G1>(null, collection,
Optional.ofNullable(null), getModelManager(), getPopupManager(), getRenderer(),
getPickManager(), (SbmtInfoWindowManager) getInfoPanelManager(),
(SbmtSpectralImageWindowManager) getSpectrumPanelManager(), getLegacyStatusHandler());
@@ -553,7 +549,7 @@ protected void setupNormalImagingTabs()
ImagingInstrumentConfig config = (ImagingInstrumentConfig) instrumentConfig;
if (config.imagingInstruments.size() == 0)
{
ImageSearchController cont = new ImageSearchController(config, collection,
ImageSearchController<G1> cont = new ImageSearchController<G1>(config, collection,
Optional.ofNullable(null), getModelManager(), getPopupManager(), getRenderer(),
getPickManager(), (SbmtInfoWindowManager) getInfoPanelManager(),
(SbmtSpectralImageWindowManager) getSpectrumPanelManager(), getLegacyStatusHandler());
@@ -564,7 +560,7 @@ protected void setupNormalImagingTabs()
{
for (ImagingInstrument instrument : config.imagingInstruments)
{
ImageSearchController cont = new ImageSearchController(config, collection, Optional.of(instrument),
ImageSearchController<G1> cont = new ImageSearchController<G1>(config, collection, Optional.of(instrument),
getModelManager(), getPopupManager(), getRenderer(), getPickManager(),
(SbmtInfoWindowManager) getInfoPanelManager(),
(SbmtSpectralImageWindowManager) getSpectrumPanelManager(), getLegacyStatusHandler());
@@ -593,7 +589,7 @@ protected void setupLineamentTab()
}
}

protected void setupSpectrumTabs()
protected <S extends BasicSpectrum> void setupSpectrumTabs()
{
List<IFeatureConfig> spectrumConfigs = getPolyhedralModelConfig()
.getConfigsForClass(SpectrumInstrumentConfig.class);
@@ -608,7 +604,7 @@ protected void setupSpectrumTabs()
SpectrumInstrumentConfig config = (SpectrumInstrumentConfig) instrumentConfig;
for (BasicSpectrumInstrument instrument : config.spectralInstruments)
{
BaseSpectrumSearchModel model = (BaseSpectrumSearchModel) SBMTSpectraFactory.getModelFor(
BaseSpectrumSearchModel<S> model = (BaseSpectrumSearchModel<S>) SBMTSpectraFactory.getModelFor(
instrument.getDisplayName(),
getModelManager().getPolyhedralModel().getBoundingBoxDiagonalLength());
JComponent component = null;
@@ -642,37 +638,14 @@ protected void setupSpectrumTabs()

protected void setupLidarTabs()
{
// // Lidar tab
// SmallBodyViewConfig tmpSmallBodyConfig = getPolyhedralModelConfig();
// String lidarInstrName = "Tracks";
// if (tmpSmallBodyConfig.hasLidarData == true)
// lidarInstrName = tmpSmallBodyConfig.lidarInstrumentName.toString();
//
// try
// {
// JComponent lidarPanel = new LidarPanel(getRenderer(), getStatusNotifier(),
// getPickManager(), tmpSmallBodyConfig, getModelManager().getPolyhedralModel(),
// getModelManager());
// addTab(lidarInstrName, lidarPanel);
// } catch (Exception e)
// {
// e.printStackTrace();
// }
LidarInstrumentConfig config = (LidarInstrumentConfig) getPolyhedralModelConfig()
.getConfigForClass(LidarInstrumentConfig.class);
if (config != null)
{
// for (IInstrumentConfig instrumentConfig :
// getPolyhedralModelConfig().getInstrumentConfigs().get(LidarInstrumentConfig.class))
// {
// LidarInstrumentConfig config = (LidarInstrumentConfig)instrumentConfig;
// JComponent component = new LidarPanel(config, getModelManager(),
// getPickManager(), getRenderer());
JComponent component = new LidarPanel(getRenderer(), getStatusNotifier(), getPickManager(), config,
smallBodyModels.get(0), getModelManager());

addTab(config.lidarInstrumentName.toString(), component);
// }
}
}

@@ -682,7 +655,7 @@ protected void setupStructuresTab()
getStatusNotifier(), getPickManager(), structureManager));
}

protected void setupCustomDataTab()
protected <S extends BasicSpectrum> void setupCustomDataTab()
{
JTabbedPane customDataPane = new JTabbedPane();
customDataPane.setBorder(BorderFactory.createEmptyBorder());
@@ -697,18 +670,15 @@ protected void setupCustomDataTab()
SpectrumInstrumentConfig config = (SpectrumInstrumentConfig) instrumentConfig;
for (BasicSpectrumInstrument i : config.spectralInstruments)
{
// if (i.getDisplayName().equals("NIS"))
// continue; //we can't properly handle NIS custom data for now without info
// files, which we don't have.
customDataPane.addTab(i.getDisplayName() + " Spectra",
new CustomSpectraSearchController(getModelManager(),
new CustomSpectraSearchController<S>(getModelManager(),
(SbmtSpectrumWindowManager) getInfoPanelManager(), getPickManager(), getRenderer(),
config.hierarchicalSpectraSearchSpecification, i, config).getPanel());
//
SpectraCollection spectrumCollection = (SpectraCollection) getModel(ModelNames.CUSTOM_SPECTRA);
SpectrumBoundaryCollection boundaryCollection = (SpectrumBoundaryCollection) getModel(
SpectraCollection<S> spectrumCollection = (SpectraCollection<S>) getModel(ModelNames.CUSTOM_SPECTRA);
SpectrumBoundaryCollection<S> boundaryCollection = (SpectrumBoundaryCollection<S>) getModel(
ModelNames.CUSTOM_SPECTRA_BOUNDARIES);
PopupMenu popupMenu = new SpectrumPopupMenu(spectrumCollection, boundaryCollection,
PopupMenu popupMenu = new SpectrumPopupMenu<S>(spectrumCollection, boundaryCollection,
getModelManager(), (SbmtSpectrumWindowManager) getInfoPanelManager(), getRenderer());
registerPopup(spectrumCollection, popupMenu);
}
@@ -738,7 +708,7 @@ protected void setupStateHistoryTab()
pomListeners.add(new PositionOrientationManagerListener()
{
@Override
public void managerUpdated(IPositionOrientationManager manager)
public void managerUpdated(IPositionOrientationManager<SmallBodyModel> manager)
{
planningController.setPositionOrientationManager(manager);
}
@@ -1086,10 +1056,10 @@ public Void apply(String arg0)
double time = TimeUtil.str2et(dateTimeString);
positionOrientationManager = new PositionOrientationManager(bodies, arg0, firstSpiceInfo,
firstSpiceInfo.getInstrumentNamesToBind()[0], spiceInfo.getBodyName(), time);
HashMap<ModelNames, List<Model>> allModels = new HashMap(getModelManager().getAllModels());
allModels.put(ModelNames.SMALL_BODY, positionOrientationManager.getUpdatedBodies());
HashMap<ModelNames, List<Model>> allModels = new HashMap<ModelNames, List<Model>>(getModelManager().getAllModels());
allModels.put(ModelNames.SMALL_BODY, (List<Model>) positionOrientationManager.getUpdatedBodies());
setModelManager(new ModelManager(bodies.get(0), allModels));
pomListeners.forEach(listener -> listener.managerUpdated(positionOrientationManager));
pomListeners.forEach(listener -> listener.managerUpdated((IPositionOrientationManager<SmallBodyModel>) positionOrientationManager));
return null;
}
});
34 changes: 34 additions & 0 deletions test/edu/jhuapl/sbmt/model/simple/TestSimpleSmallBody.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package edu.jhuapl.sbmt.model.simple;

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

class TestSimpleSmallBody
{

@BeforeAll
static void setUpBeforeClass() throws Exception
{
}

@AfterAll
static void tearDownAfterClass() throws Exception
{
}

@Test
void testGetDensity()
{
fail("Not yet implemented");
}

@Test
void testGetRotationRate()
{
fail("Not yet implemented");
}

}

0 comments on commit 2397d7a

Please sign in to comment.