Browse Source

Gmt module: all functions return const ObjectBase*

ObjPtr
Michael Uleysky 9 years ago
parent
commit
18911f66b5
  1. 16
      modules/gmt/modgmt_func.cpp
  2. 20
      modules/gmt/modgmt_func.h
  3. 8
      modules/gmt/modgmt_map.cpp
  4. 8
      modules/gmt/modgmt_map.h
  5. 1
      modules/gmt/modgmt_structs.h

16
modules/gmt/modgmt_func.cpp

@ -11,17 +11,17 @@ static double AutoStep(double b, double e)
return div;
}
ObjectBase* GMT_Header(const ObjectList* input)
const ObjectBase* GMT_Header(const ObjectList* input)
{
return new ObjectString(header);
}
ObjectBase* GMT_Footer(const ObjectList* input)
const ObjectBase* GMT_Footer(const ObjectList* input)
{
return new ObjectString(footer);
}
ObjectBase* GMT_ColorGray(const ObjectList* input)
const ObjectBase* GMT_ColorGray(const ObjectList* input)
{
struct gmt_color c;
bool suc=true;
@ -36,7 +36,7 @@ ObjectBase* GMT_ColorGray(const ObjectList* input)
else return 0;
}
ObjectBase* GMT_ColorRGB(const ObjectList* input)
const ObjectBase* GMT_ColorRGB(const ObjectList* input)
{
struct gmt_color c;
bool suc=true;
@ -53,7 +53,7 @@ ObjectBase* GMT_ColorRGB(const ObjectList* input)
else return 0;
}
ObjectBase* GMT_ColorHSV(const ObjectList* input)
const ObjectBase* GMT_ColorHSV(const ObjectList* input)
{
struct gmt_color c;
bool suc=true;
@ -71,7 +71,7 @@ ObjectBase* GMT_ColorHSV(const ObjectList* input)
else return 0;
}
ObjectBase* GMT_ColorCMYK(const ObjectList* input)
const ObjectBase* GMT_ColorCMYK(const ObjectList* input)
{
struct gmt_color c;
bool suc=true;
@ -95,7 +95,7 @@ Input:
1) Three arguments, first is Layer, second and third are double. Interprets as new absolute position in cm.
2) Pairs list. Names are l (layer), x, y, xrel (xr), yrel (yr). Pair with name l may be absent, in this case search in list and using as layer object with ObjectGMTLayer type. x and y are absolute positions in cm, xrel and yrel are shift from current position. x (y) and xrel (yrel) are mutually exlusive, but x (y) and yrel (xrel) can be used simultaneously. If position for some axis is absent, then this position is unchanged.
*/
ObjectBase* GMT_LayerShift(const ObjectList* input)
const ObjectBase* GMT_LayerShift(const ObjectList* input)
{
auto size=input->Size();
struct gmt_layer layer;
@ -165,7 +165,7 @@ transpmodel - transparency model, string. Choose from Color, ColorBurn, ColorDod
x, xr or xrel - shift layer on x cm in horisontal direction. Default is 0.
y, yr or yrel - shift layer on y cm in vertical direction. Default is 0.
*/
ObjectBase* GMT_DrawFrame(const ObjectList* input)
const ObjectBase* GMT_DrawFrame(const ObjectList* input)
{
std::string opts="-P -O -K ";
bool suc=true;

20
modules/gmt/modgmt_func.h

@ -3,13 +3,13 @@
#include "modgmt_internals.h"
#include "modgmt_objects.h"
ObjectBase* GMT_Header(const ObjectList* input);
ObjectBase* GMT_Footer(const ObjectList* input);
ObjectBase* GMT_ColorGray(const ObjectList* input);
ObjectBase* GMT_ColorRGB(const ObjectList* input);
ObjectBase* GMT_ColorHSV(const ObjectList* input);
ObjectBase* GMT_ColorCMYK(const ObjectList* input);
ObjectBase* GMT_LayerShift(const ObjectList* input);
const ObjectBase* GMT_Header(const ObjectList* input);
const ObjectBase* GMT_Footer(const ObjectList* input);
const ObjectBase* GMT_ColorGray(const ObjectList* input);
const ObjectBase* GMT_ColorRGB(const ObjectList* input);
const ObjectBase* GMT_ColorHSV(const ObjectList* input);
const ObjectBase* GMT_ColorCMYK(const ObjectList* input);
const ObjectBase* GMT_LayerShift(const ObjectList* input);
// Extension of OBTypeM template for easy work with lists
template<template<typename> class Func, class... O>
@ -1430,7 +1430,7 @@ class Convert2Struct<struct gmt_font, ObjectList>
// Template for generating GMTObject from ObjectList
template<class Struct>
ObjectBase* GMT_Type(const ObjectList* input)
const ObjectBase* GMT_Type(const ObjectList* input)
{
bool suc=true;
Struct s=Convert2Struct<Struct,ObjectList>()(input,&suc);
@ -1439,9 +1439,9 @@ ObjectBase* GMT_Type(const ObjectList* input)
}
// Shift position of layer
ObjectBase* GMT_LayerShift(const ObjectList* input);
const ObjectBase* GMT_LayerShift(const ObjectList* input);
// Draw frame with tics
ObjectBase* GMT_DrawFrame(const ObjectList* input);
const ObjectBase* GMT_DrawFrame(const ObjectList* input);
#endif

8
modules/gmt/modgmt_map.cpp

@ -59,7 +59,7 @@ xg and yg set global shift (for all subsequent layers).
xgr and ygr add corresponding values to global shift.
Resulted shift is added to own shift of layer (setted by function LayerShift).
*/
ObjectBase* GMT_Map(const ObjectList* input)
const ObjectBase* GMT_Map(const ObjectList* input)
{
const ObjectList* list=input;
auto size=list->Size();
@ -233,7 +233,7 @@ Input:
One argument must be GMTMap.
Optionally, resolution can be specified by pair with name resolution, res or r and double value. Default is 720.
*/
ObjectBase* GMT_Convert2PDF(const ObjectList* input)
const ObjectBase* GMT_Convert2PDF(const ObjectList* input)
{
if(!gs_abilities.havepdf) return 0; // No pdf support
double r;
@ -284,7 +284,7 @@ textantialiasing or taa - is a string, can be "none" ("no"), "small" ("s") or "f
graphicsantialiasing or gaa - is a string, can be "none", "small" or "full". Controls graphics antialiasing. Default: "full".
antialiasing or aa - can be used to set graphics and text antialiasing simultaneously.
*/
ObjectBase* GMT_Convert2PNG(const ObjectList* input)
const ObjectBase* GMT_Convert2PNG(const ObjectList* input)
{
if(!gs_abilities.havepdf) return 0; // No pdf support, so, no png
double r;
@ -408,7 +408,7 @@ textantialiasing or taa - is a string, can be "none" ("no"), "small" ("s") or "f
graphicsantialiasing or gaa - is a string, can be "none", "small" or "full". Controls graphics antialiasing. Default: "full".
antialiasing or aa - can be used to set graphics and text antialiasing simultaneously.
*/
ObjectBase* GMT_Convert2JPG(const ObjectList* input)
const ObjectBase* GMT_Convert2JPG(const ObjectList* input)
{
if(!gs_abilities.havepdf) return 0; // No pdf support, so, no jpeg
double r;

8
modules/gmt/modgmt_map.h

@ -80,16 +80,16 @@ class PInt
};
// Creating eps map from set of layers
ObjectBase* GMT_Map(const ObjectList* input);
const ObjectBase* GMT_Map(const ObjectList* input);
// Converting map to pdf
ObjectBase* GMT_Convert2PDF(const ObjectList* input);
const ObjectBase* GMT_Convert2PDF(const ObjectList* input);
// Converting map to png
ObjectBase* GMT_Convert2PNG(const ObjectList* input);
const ObjectBase* GMT_Convert2PNG(const ObjectList* input);
// Converting map to jpeg
ObjectBase* GMT_Convert2JPG(const ObjectList* input);
const ObjectBase* GMT_Convert2JPG(const ObjectList* input);
#endif

1
modules/gmt/modgmt_structs.h

@ -3,6 +3,7 @@
#include <cinttypes>
#include <cmath>
#include <map>
#include <vector>
#include "common.h"
#include "modgmt_colornames.h"

Loading…
Cancel
Save