*** empty log message ***
This commit is contained in:
parent
0c26df737d
commit
4ef7ac822c
|
|
@ -47,12 +47,19 @@ StitchImageProgram() {
|
|||
&StitchImageProgram::dispatch_double, NULL, &_filter_factor);
|
||||
|
||||
add_option
|
||||
("n", "name", 0,
|
||||
("o", "name", 0,
|
||||
"Generates only the named output image. This may be repeated to "
|
||||
"generate multiple images in one run. If omitted, all output images "
|
||||
"in the file are generated.",
|
||||
"in the file are generated. The name may include filename globbing "
|
||||
"symbols, e.g. 'grid*'. You should quote such names to protect them "
|
||||
"from shell expansion.",
|
||||
&StitchImageProgram::dispatch_output_name);
|
||||
|
||||
add_option
|
||||
("i", "name", 0,
|
||||
"Generates only the named input image or images, as above.",
|
||||
&StitchImageProgram::dispatch_input_name);
|
||||
|
||||
add_option
|
||||
("s", "xsize,ysize", 0,
|
||||
"Generates the output image(s) at the specified size, rather than the "
|
||||
|
|
@ -89,6 +96,19 @@ dispatch_output_name(ProgramBase *self, const string &opt,
|
|||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: StitchImageProgram::dispatch_input_name
|
||||
// Access: Protected, Static
|
||||
// Description: Dispatch function for an input image name.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool StitchImageProgram::
|
||||
dispatch_input_name(ProgramBase *self, const string &opt,
|
||||
const string &arg, void *) {
|
||||
StitchImageProgram *prog = (StitchImageProgram *)self;
|
||||
prog->_outputter.add_input_name(arg);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
StitchImageProgram prog;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ public:
|
|||
protected:
|
||||
static bool dispatch_output_name(ProgramBase *self, const string &opt,
|
||||
const string &arg, void *);
|
||||
static bool dispatch_input_name(ProgramBase *self, const string &opt,
|
||||
const string &arg, void *);
|
||||
|
||||
private:
|
||||
double _filter_factor;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "compose_matrix.h"
|
||||
#include "rotate_to.h"
|
||||
#include "executionEnvironment.h"
|
||||
|
||||
StitchImage::
|
||||
StitchImage(const string &name, const string &filename,
|
||||
|
|
@ -34,9 +35,13 @@ StitchImage(const string &name, const string &filename,
|
|||
_film_offset_mm(film_offset_mm),
|
||||
_transform(LMatrix4d::ident_mat()),
|
||||
_inv_transform(LMatrix4d::ident_mat()),
|
||||
_filename(filename),
|
||||
_name(name)
|
||||
{
|
||||
_filename = ExecutionEnvironment::expand_string(filename);
|
||||
if (_name.empty()) {
|
||||
_name = _filename.get_basename_wo_extension();
|
||||
}
|
||||
|
||||
_size_mm.set((_size_pixels[0] - 1.0) / _pixels_per_mm[0],
|
||||
(_size_pixels[1] - 1.0) / _pixels_per_mm[1]);
|
||||
_orig_size_pixels = _size_pixels;
|
||||
|
|
|
|||
|
|
@ -32,20 +32,21 @@ StitchImageRasterizer() {
|
|||
|
||||
void StitchImageRasterizer::
|
||||
add_input_image(StitchImage *image) {
|
||||
_input_images.push_back(image);
|
||||
if (has_input_name(image->get_name())) {
|
||||
cerr << "Input image " << image->get_name() << "\n";
|
||||
_input_images.push_back(image);
|
||||
}
|
||||
}
|
||||
|
||||
void StitchImageRasterizer::
|
||||
add_output_image(StitchImage *image) {
|
||||
if (has_output_name(image->get_name())) {
|
||||
cerr << "Output image " << image->get_name() << "\n";
|
||||
if (_got_output_size) {
|
||||
image->set_size_pixels(LPoint2d(_output_xsize, _output_ysize));
|
||||
}
|
||||
image->set_output_scale_factor(_filter_factor);
|
||||
_output_images.push_back(image);
|
||||
|
||||
} else {
|
||||
cerr << "Ignoring output image " << image->get_name() << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -99,16 +100,56 @@ execute() {
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: StitchImageRasterizer::add_input_name
|
||||
// Access: Public
|
||||
// Description: Adds the indicated name to the set of input image
|
||||
// names that will be generated. The name may include
|
||||
// globbing symbols. If no names are added, all input
|
||||
// images will be generated.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void StitchImageRasterizer::
|
||||
add_input_name(const string &name) {
|
||||
_input_names.push_back(GlobPattern(name));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: StitchImageRasterizer::has_input_name
|
||||
// Access: Public
|
||||
// Description: Returns true if the indicated input image name is
|
||||
// one that should be generated. This will be true if
|
||||
// this name has been added via add_input_name(), or if
|
||||
// no names at all have been added.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool StitchImageRasterizer::
|
||||
has_input_name(const string &name) const {
|
||||
if (_input_names.empty()) {
|
||||
// If no names have been added, all names are good.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Otherwise, the name is good only if it matches a name on the list.
|
||||
Names::const_iterator ni;
|
||||
for (ni = _input_names.begin(); ni != _input_names.end(); ++ni) {
|
||||
if ((*ni).matches(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: StitchImageRasterizer::add_output_name
|
||||
// Access: Public
|
||||
// Description: Adds the indicated name to the set of output image
|
||||
// names that will be generated. If no names are added,
|
||||
// all output images will be generated.
|
||||
// names that will be generated. The name may include
|
||||
// globbing symbols. If no names are added, all output
|
||||
// images will be generated.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void StitchImageRasterizer::
|
||||
add_output_name(const string &name) {
|
||||
_output_names.insert(name);
|
||||
_output_names.push_back(GlobPattern(name));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -126,8 +167,15 @@ has_output_name(const string &name) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
// Otherwise, the name is good only if it is on the list.
|
||||
return (_output_names.count(name) != 0);
|
||||
// Otherwise, the name is good only if it matches a name on the list.
|
||||
Names::const_iterator ni;
|
||||
for (ni = _output_names.begin(); ni != _output_names.end(); ++ni) {
|
||||
if ((*ni).matches(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
#include "stitchImageOutputter.h"
|
||||
|
||||
#include "pvector.h"
|
||||
#include "pset.h"
|
||||
#include "luse.h"
|
||||
#include "globPattern.h"
|
||||
|
||||
class Stitcher;
|
||||
class StitchImage;
|
||||
|
|
@ -38,6 +38,8 @@ public:
|
|||
|
||||
virtual void execute();
|
||||
|
||||
void add_input_name(const string &name);
|
||||
bool has_input_name(const string &name) const;
|
||||
void add_output_name(const string &name);
|
||||
bool has_output_name(const string &name) const;
|
||||
|
||||
|
|
@ -62,7 +64,8 @@ private:
|
|||
typedef pvector<Stitcher *> Stitchers;
|
||||
Stitchers _stitchers;
|
||||
|
||||
typedef pset<string> Names;
|
||||
typedef pvector<GlobPattern> Names;
|
||||
Names _input_names;
|
||||
Names _output_names;
|
||||
|
||||
double _filter_factor;
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ NUMERIC ([+-]?(([0-9]+[.]?)|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
|
|||
return STRING;
|
||||
}
|
||||
|
||||
[a-zA-Z][a-zA-Z0-9_]* {
|
||||
[a-zA-Z][a-zA-Z0-9_-]* {
|
||||
// Identifier or keyword.
|
||||
accept();
|
||||
string str = yytext;
|
||||
|
|
|
|||
Loading…
Reference in New Issue