Skip to content

Commit

Permalink
add definition for RasterSymbolizer
Browse files Browse the repository at this point in the history
  • Loading branch information
jansule committed Mar 21, 2019
1 parent 3f97b91 commit 7fbeb47
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 2 deletions.
72 changes: 70 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export interface NegationFilter extends Filter {
/**
* The kind of the Symbolizer
*/
export type SymbolizerKind = 'Fill' | 'Icon' | 'Line' | 'Text' | 'Mark';
export type SymbolizerKind = 'Fill' | 'Icon' | 'Line' | 'Text' | 'Mark' | 'Raster';

/**
* A Symbolizer describes the style representation of geographical data.
Expand Down Expand Up @@ -231,10 +231,77 @@ export interface LineSymbolizer extends BaseSymbolizer {
*/
export type PointSymbolizer = IconSymbolizer | MarkSymbolizer | TextSymbolizer;

/**
* A single entry for the ColorMap.
*/
export interface ColorMapEntry {
color: string;
quantity?: number;
label?: string;
opacity?: number;
}

/**
* The Types that are allowed in a ColorMap.
*/
export type ColorMapType = 'ramp'|'intervals'|'values';

/**
* A ColorMap defines the color values for the pixels of a raster image.
*/
export interface ColorMap {
type: ColorMapType;
colorMapEntries?: ColorMapEntry[];
extended?: boolean;
}

/**
* A ContrastEnhancement defines how the contrast of image data should be enhanced.
*/
export interface ContrastEnhancement {
enhancementType?: 'normalize' | 'histogram';
gammaValue?: number;
}

/**
* A Channel defines the properties for a color channel.
*/
export interface Channel {
sourceChannelName?: string;
contrastEnhancement?: ContrastEnhancement;
}

/**
* A RGBChannel defines how dataset bands are mapped to image color channels.
*/
export interface RGBChannel {
redChannel: Channel;
blueChannel: Channel;
greenChannel: Channel;
}

/**
* A GrayChannel defines how a single dataset band is mapped to a grayscale channel.
*/
export interface GrayChannel {
grayChannel: Channel;
}

/**
* A RasterSymbolizer defines the style representation of RASTER data.
*/
export interface RasterSymbolizer {
kind: 'Raster';
opacity?: number;
colorMap?: ColorMap;
channelSelection?: RGBChannel | GrayChannel;
contrastEnhancement?: ContrastEnhancement;
}

/**
* All operators.
*/
export type Symbolizer = PointSymbolizer | LineSymbolizer | FillSymbolizer;
export type Symbolizer = PointSymbolizer | LineSymbolizer | FillSymbolizer | RasterSymbolizer;

/**
* A Rule combines a specific amount of data (defined by a filter and a
Expand Down Expand Up @@ -279,6 +346,7 @@ export interface UnsupportedProperties {
FillSymbolizer?: any;
MarkSymbolizer?: any;
IconSymbolizer?: any;
RasterSymbolizer?: any;
}
}

Expand Down
18 changes: 18 additions & 0 deletions sample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,24 @@ const sampleStyle: Style = {
graphicFill: {
kind: 'Icon'
}
}, {
kind: 'Raster',
opacity: 1,
colorMap: {
colorMapEntries: [
{
color: '#00FFFF',
quantity: 100
}
],
extended: false,
type: "ramp"
},
channelSelection: {
grayChannel: {
sourceChannelName: '1'
}
}
}]
}
]
Expand Down

0 comments on commit 7fbeb47

Please sign in to comment.