Skip to content

Add plugin support and fix image size #162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 39 additions & 10 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,7 @@
<mkdir dir="${release.dir}/extra" />
<mkdir dir="${release.dir}/samples" />
<mkdir dir="${release.dir}/doc" />
<mkdir dir="${release.dir}/plugin" />

<!-- Copy the application and dependencies -->
<copy todir="${release.dir}">
Expand Down Expand Up @@ -1170,7 +1171,6 @@
<exclude name="slf4j*.jar" />
<exclude name="*.lib" />
</fileset>

<fileset dir="${hdf5.lib.dir}">
<include name="*.jar" />
<include name="hdf5_java.dll" />
Expand All @@ -1188,7 +1188,6 @@
<include name="mfhdf.dll"/>
<include name="xdr.dll"/>
</fileset>

<fileset dir="${hdf5.lib.dir}">
<include name="hdf5_java.dll" />
</fileset>
Expand All @@ -1197,6 +1196,18 @@
<include name="hdf5.dll"/>
</fileset>
</copy>
<!-- Optional copy xdr -->
<copy todir="${release.dir}/bin" failonerror="false">
<fileset dir="${hdf.lib.dir}/../bin">
<include name="xdr.dll"/>
</fileset>
</copy>
<!-- Optional copy plugins -->
<copy todir="${release.dir}/bin/plugin" failonerror="false">
<fileset dir="${hdf5.lib.dir}/plugin">
<include name="*.dll" />
</fileset>
</copy>

<!-- Create the run batch file -->
<copy file="${packagefiles.dir}/hdfview.bat.in" tofile="${release.dir}/hdfview.bat" />
Expand All @@ -1220,10 +1231,6 @@
<fileset dir="${hdf.lib.dir}" followsymlinks="true">
<filename regex="libmfhdf\.so(\.[0-9])$"/>
</fileset>
<fileset dir="${hdf.lib.dir}" followsymlinks="true">
<filename regex="libxdr\.so(\.[0-9])$"/>
<exclude name="*.a" />
</fileset>
<fileset dir="${hdf5.lib.dir}" followsymlinks="true">
<include name="libhdf5_java.so" />
<include name="*.jar" />
Expand All @@ -1233,6 +1240,19 @@
<filename regex="libhdf5\.so(\.[0-9][0-9][0-9][0-9]?)$"/>
</fileset>
</copy>
<!-- Optional copy xdr -->
<copy todir="${release.dir}" failonerror="false">
<fileset dir="${hdf.lib.dir}" followsymlinks="true">
<filename regex="libxdr\.so(\.[0-9])$"/>
<exclude name="*.a" />
</fileset>
</copy>
<!-- Optional copy plugins -->
<copy todir="${release.dir}/plugin" failonerror="false">
<fileset dir="${hdf5.lib.dir}/plugin">
<include name="*.so" />
</fileset>
</copy>

<!-- Create the .sh run script -->
<copy file="${packagefiles.dir}/hdfview.sh.in" tofile="${release.dir}/hdfview.sh" />
Expand Down Expand Up @@ -1263,10 +1283,6 @@
<filename regex="libmfhdf(\.[0-9])(\.dylib)$"/>
<exclude name="*.a" />
</fileset>
<fileset dir="${hdf.lib.dir}" followsymlinks="true">
<filename regex="libxdr(\.[0-9])(\.dylib)$"/>
<exclude name="*.a" />
</fileset>
<fileset dir="${hdf5.lib.dir}" followsymlinks="true">
<include name="libhdf5_java.dylib" />
<include name="*.jar" />
Expand All @@ -1277,6 +1293,19 @@
<exclude name="*.a" />
</fileset>
</copy>
<!-- Optional copy xdr -->
<copy todir="${release.dir}" failonerror="false">
<fileset dir="${hdf.lib.dir}" followsymlinks="true">
<filename regex="libxdr(\.[0-9])(\.dylib)$"/>
<exclude name="*.a" />
</fileset>
</copy>
<!-- Optional copy plugins -->
<copy todir="${release.dir}/plugin" failonerror="false">
<fileset dir="${hdf5.lib.dir}/plugin">
<include name="*.dylib" />
</fileset>
</copy>
</target>

<!-- =================================================================
Expand Down
7 changes: 7 additions & 0 deletions src/org.hdfgroup.hdfview/hdf/view/HDFView.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
import hdf.view.dialog.UserOptionsNode;
import hdf.view.dialog.UserOptionsViewModulesPage;

import hdf.hdf5lib.H5;

/**
* HDFView is the main class of this HDF visual tool. It is used to layout the graphical components of the hdfview. The
Expand Down Expand Up @@ -291,6 +292,9 @@ public HDFView(String root, String start_dir) {
currentFont = null;
}

if (FileFormat.getFileFormat(FileFormat.FILE_TYPE_HDF5) != null)
H5.H5PLappend(ViewProperties.getPluginDir());

treeViews = ViewProperties.getTreeViewList();
metaDataViews = ViewProperties.getMetaDataViewList();
tableViews = ViewProperties.getTableViewList();
Expand Down Expand Up @@ -907,6 +911,9 @@ public void widgetSelected(SelectionEvent e) {
// this will always overwrite the currentDir until isWorkDirChanged() is fixed
currentDir = ViewProperties.getWorkDir();

if (FileFormat.getFileFormat(FileFormat.FILE_TYPE_HDF5) != null)
H5.H5PLappend(ViewProperties.getPluginDir());

//if (userOptionDialog.isFontChanged()) {
Font font = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ public void widgetDisposed(DisposeEvent e) {
}
}


// Setup subset information
int space_type = dataObject.getSpaceType();
int rank = dataObject.getRank();
Expand Down
37 changes: 37 additions & 0 deletions src/org.hdfgroup.hdfview/hdf/view/ViewProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ public static enum BITMASK_OP {
/** default starting file directory */
private static String workDir = System.getProperty("user.dir");

/** default plugin directory */
private static String pluginDir = System.getProperty("user.dir") + "/plugin";

/** default HDF file extensions */
private static String fileExt = "hdf, h4, hdf4, h5, hdf5, he2, he5";

Expand Down Expand Up @@ -318,6 +321,8 @@ public ViewProperties(String viewRoot, String viewStart) {

setUsersGuide(rootDir + usersGuide);

setPluginDir(rootDir + "/plugin");

setDefault("users.guide", viewRoot + "/UsersGuide/index.html");
setDefault("image.contrast", false);
setDefault("image.showvalues", false);
Expand Down Expand Up @@ -1450,6 +1455,10 @@ public void load() throws IOException {
if (!isDefault("work.dir"))
setWorkDir(propVal);

propVal = getString("plugin.dir");
if (!isDefault("plugin.dir"))
setPluginDir(propVal);

propVal = getString("file.extension");
if (!isDefault("file.extension")) {
setFileExtension(propVal);
Expand Down Expand Up @@ -1554,6 +1563,9 @@ public void save() throws IOException {

if (workDir != null) setValue("work.dir", workDir);

if (pluginDir != null)
setValue("plugin.dir", pluginDir);

if (fileExt != null) setValue("file.extension", fileExt);

if (h4toh5 != null) setValue("h4toh5.converter", h4toh5);
Expand Down Expand Up @@ -1693,6 +1705,21 @@ public static String getWorkDir() {
return workPath;
}

/** @return the default plugin directory. */
public static String getPluginDir() {
String pluginPath = pluginDir;
log.trace("getPluginDir: pluginDir={}", pluginDir);
if (pluginPath == null) {
pluginPath = System.getProperty("hdfview.plugindir");
log.trace("getPluginDir: hdfview.plugindir={}", pluginPath);
if (pluginPath == null) {
pluginPath = System.getProperty("user.dir") + "/plugin";
}
}
log.trace("getPluginDir: final pluginPath={}", pluginPath);
return pluginPath;
}

/** @return the maximum number of the most recent file */
public static int getMaxRecentFiles() {
return MAX_RECENT_FILES;
Expand Down Expand Up @@ -1868,6 +1895,16 @@ public static void setWorkDir(String wDir) {
workDir = wDir;
}

/**
* set the path of the default plugin directory
*
* @param plDir the default plugin directory
*/
public static void setPluginDir(String plDir) {
log.trace("ViewProperties:setPluginDir plDir={}", plDir);
pluginDir = plDir;
}

/** set the file extension
*
* @param ext
Expand Down
Loading