Skip to content

Commit

Permalink
Merge pull request #10 from jlaura/master
Browse files Browse the repository at this point in the history
Updates from upstream
  • Loading branch information
jlaura authored Dec 20, 2018
2 parents fba5699 + b73108d commit 7f88047
Show file tree
Hide file tree
Showing 11 changed files with 500 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@


HEADERS = csm.h Error.h Warning.h Version.h Isd.h BytestreamIsd.h NitfIsd.h Plugin.h Model.h GeometricModel.h RasterGM.h CorrelationModel.h FourParameterCorrelationModel.h LinearDecayCorrelationModel.h csmPointCloud.h PointCloudIsd.h PointCloudGM.h ModelIdentifier.h BundleGM.h Ellipsoid.h SettableEllipsoid.h
HEADERS = csm.h Error.h Warning.h Version.h Isd.h BytestreamIsd.h NitfIsd.h MultiNitfIsd.h Plugin.h Model.h GeometricModel.h RasterGM.h CorrelationModel.h FourParameterCorrelationModel.h LinearDecayCorrelationModel.h csmPointCloud.h PointCloudIsd.h PointCloudGM.h ModelIdentifier.h BundleGM.h Ellipsoid.h SettableEllipsoid.h

OBJS = Version.o Isd.o Plugin.o GeometricModel.o RasterGM.o CorrelationModel.o FourParameterCorrelationModel.o LinearDecayCorrelationModel.o csmPointCloud.o PointCloudIsd.o PointCloudGM.o ModelIdentifier.o BundleGM.o Ellipsoid.o SettableEllipsoid.o
OBJS = Version.o Isd.o Plugin.o GeometricModel.o RasterGM.o CorrelationModel.o FourParameterCorrelationModel.o LinearDecayCorrelationModel.o csmPointCloud.o PointCloudIsd.o PointCloudGM.o ModelIdentifier.o BundleGM.o Ellipsoid.o SettableEllipsoid.o MultiNitfIsd.o


LIBNAME=libcsmapi
Expand Down
10 changes: 6 additions & 4 deletions Makefile.win32
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include Makefile

CC=mscc
LD=mslink
CC=./scripts/mscc
LD=./scripts/mslink
CDEBUGFLAGS=-O2
COPTS=/nologo $(CDEBUGFLAGS) /Zm800 /MD /GR /W1 /EHa $(DEFINES)
DEFINES=-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE
Expand All @@ -11,7 +11,9 @@ LIBRARY=$(LIBNAME).dll

INSTDIR=$(PWD)/win32

all: $(HEADERS) $(LIBRARY)
# warning -- this target does not work because it ends up running the linker command from Makefile
# instead make 'csmapi.dll'
all: $(LIBRARY)

%.o: %.cpp
$(CC) -c $(COPTS) $< -Fo$@
Expand All @@ -20,7 +22,7 @@ all: $(HEADERS) $(LIBRARY)
$(CC) -c $(COPTS) $< -Fo$@

$(LIBRARY): $(OBJS)
objects_to_def -dir . -proj $(@:%.dll=%) > $(@:%.dll=%.ldf)
./scripts/objects_to_def -dir . -proj $(@:%.dll=%) > $(@:%.dll=%.ldf)
$(LD) $(COPTS) $(LDOPTS) /DEF:$(@:%.dll=%.ldf) -o $@ $^

install::
Expand Down
79 changes: 79 additions & 0 deletions MultiNitfIsd.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//#############################################################################
//
// FILENAME: MultiNitfIsd.cpp
//
// CLASSIFICATION: Unclassified
//
// DESCRIPTION:
//
// This file contains the implementations for the functions defined in CSM.
//
// LIMITATIONS: None
//
// SOFTWARE HISTORY:
// Date Author Comment
// ----------- ------ -------
// 28-NOV-2018 JPK Initial Version.
// 29-NOV-2018 SCM Cleanup formatting and added include of Error.h.
//
// NOTES:
//
//#############################################################################

#ifndef CSM_LIBRARY
#define CSM_LIBRARY
#endif

#include "MultiNitfIsd.h"
#include "Error.h"

namespace csm
{

//*****************************************************************************
// MultiNitfIsd::MultiNitfIsd
//*****************************************************************************
MultiNitfIsd::MultiNitfIsd(const std::vector<csm::NitfIsd>& isdList)
:
Isd("MULTINITF", ""),
theISDs(isdList)
{
}

//*****************************************************************************
// MultiNitfIsd::addIsd
//*****************************************************************************
void MultiNitfIsd::addIsd(const csm::NitfIsd &isd)
{
theISDs.push_back(isd);
}

//*****************************************************************************
// MultiNitfIsd::isdList
//*****************************************************************************
const std::vector<csm::NitfIsd>& MultiNitfIsd::isdList() const
{
return theISDs;
}

//*****************************************************************************
// MultiNitfIsd::isdList
//*****************************************************************************
std::vector<csm::NitfIsd>& MultiNitfIsd::isdList()
{
return theISDs;
}

//*****************************************************************************
// MultiNitfIsd::isd
//*****************************************************************************
const csm::NitfIsd& MultiNitfIsd::isd(std::size_t index) const
{
if (index < theISDs.size()) return theISDs[index];

throw Error(Error::INDEX_OUT_OF_RANGE,
"ISD Index is out of range.",
"csm::MultiNitfIsd::isd");
}

} //namespace csm
88 changes: 88 additions & 0 deletions MultiNitfIsd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
//#############################################################################
//
// FILENAME: MultiNitfIsd.h
//
// CLASSIFICATION: Unclassified
//
// DESCRIPTION:
//
// Header for the MultiNitfIsd base class. MultiNitfIsd is encapsulated in a
// C++ class for transfer through the CSM (Plugin) interface. MultiNitfIsd
// holds a vector of csm::NitfIsds
//
// LIMITATIONS: None
//
// SOFTWARE HISTORY:
//
// Date Author Comment
// ----------- ------ -------
// 28-NOV-2018 JPK Initial Version.
// 29-NOV-2018 SCM Cleanup formatting. Use std::size_t for size.
//
// NOTES:
//
//#############################################################################

#ifndef __CSM_MULTINITFISD_H
#define __CSM_MULTINITFISD_H

#include <string>
#include <vector>

#include "csm.h"
#include "NitfIsd.h"

namespace csm
{

class CSM_EXPORT_API MultiNitfIsd : public Isd
{
public:
MultiNitfIsd() : Isd("MULTINITF", ""), theISDs() {}
//> This constructor makes an empty image support data list.
//<

explicit MultiNitfIsd(const std::vector<csm::NitfIsd>& isdList);
//> This constructor stores one or more image support data objects.
//<

const std::string& format() const { return theFormat; }
//> This method returns the format of the image support data (MULTINITF).
//<

void addIsd(const csm::NitfIsd& isd);
//> This method adds a csm::NitfIsd to the MultiNitfIsd.
//<

const std::vector<csm::NitfIsd>& isdList() const;
//> This method allows const retrieval of the entire
// vector of available csm::NitfIsd objects.
//<

std::vector<csm::NitfIsd>& isdList();
//> This method allows non-const retrieval of the
// vector of available csm::NitfIsd objects, allowing the
// vector to be modified (added to / deleted from).
//<

void clearAllIsds() { theISDs.clear(); }
//> This method removes all the ISDs added to the vector.
//<

std::size_t numberOfIsds() const {return theISDs.size();}
//> This method returns the number of available ISDs owned
// by this class.
//<

const csm::NitfIsd& isd(std::size_t index) const;
//> This method returns the csm::NitfIsd at the specified
// index.
//<

protected:
std::vector<csm::NitfIsd> theISDs;
};

} // namespace csm

#endif
3 changes: 3 additions & 0 deletions PointCloudGM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@
// getValidModelBounds function.
// 22-Feb-2018 JPK Replaced macros for inclusion in a single
// library. Reformatted for readability
// 26-Sep-2018 SCM Added define of CSM_LIBRARY for Windows.
//
// NOTES:
//
//#############################################################################

#define CSM_LIBRARY

#include <algorithm>
#include "PointCloudGM.h"

Expand Down
1 change: 1 addition & 0 deletions PointCloudIsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Date Author Comment
// ----------- ------ -------
// 20-Mar-2013 SCM Initial Coding
// 26-Sep-2018 SCM Added define of CSM_LIBRARY for Windows.
//
// NOTES:
//
Expand Down
6 changes: 6 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ By default, the built files are placed in an architecture subdirectory in the bu

Compiling makes a 'csmapi' shared library (libcsmapi.so.3.0.3 on UNIX, csmapi.dll on Windows). This library must be used when creating both CSM plugins and Sensor Exploitation Tools (SETs) that use CSM.


Windows
-------
Windows compliation requires the use of Cygwin to provide tools like 'make' and 'perl'. You should also be sure that Microsoft's Visual C++'s "cl.exe" is in your $PATH and that $INCLUDE and $LIB are set appropriately. When compiling on Windows, the "all" target does not do the right thing. Instead build with:

make -f Makefile.win32 csmapi.dll install clean
3 changes: 3 additions & 0 deletions csmPointCloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
// 22FEB2018 JPK Modified to use existing csm macros (since
// point cloud is no longer in a separate library).
// Other minor cleanup for consistency of code.
// 26-Sep-2018 SCM Added define of CSM_LIBRARY for Windows.
//
// NOTES:
//
//#############################################################################

#define CSM_LIBRARY
#include "csmPointCloud.h"
#include "Error.h"
#include <cmath>
Expand Down
65 changes: 65 additions & 0 deletions scripts/mscc
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/sh
eval 'exec perl -x $0 ${1+"$@"}'
if 0; # [Construct to start `perl' when we do not know where it is.]
#!perl
###############################################################################
# FILE: mscc
#
# CLASSIFICATION: Unclassified
#
# DESCRIPTION: This is a wrapper script that mutates a Unix
# compile command into the MS Studio equivalent
#
# LIMITATIONS: Requires Cgywin's "cygpath" application to convert paths
#
###############################################################################

my $debug = 0;

# ***
# Convert optimization argument to mscc expected format
# Convert paths to Windows format
# ***
my $compile_debug = grep(/^-g$/, @ARGV);

my @compile_args = ();
foreach (@ARGV)
{
if ($compile_debug)
{
s/^\-O[0-9]/\/Od/;
}
else
{
s/^\-O/\/O/;
}

if (/^\-I(.+)/)
{
chomp(my $winPath = `cygpath -w "$1"`);
$_ = "\/I$winPath";
}
if (/^\-Fo(.+)/)
{
chomp(my $winPath = `cygpath -w "$1"`);
$_ = "-Fo$winPath";
}

if ($_ eq "-g")
{
push @compile_args, '/Yd';
push @compile_args, '/Z7';
$_ = '';
}

push @compile_args, $_ if ($_);
}

# Build the compile command
$compile="cl.exe";

warn ">>> compile_args are {" . join(', ', @compile_args) . "}\n" if ($debug);

# Execute the compile command
print "$compile " . join(' ', @compile_args) . "\n";
exec $compile, @compile_args or die "Could not exec: $!\n";
Loading

0 comments on commit 7f88047

Please sign in to comment.