123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- #include "sys-defines.h"
- #include "extern.h"
- #define MAXIMUM_MARKER_DIMENSION (5.0/8.0)
- bool
- _pl_c_paint_marker (R___(Plotter *_plotter) int type, double size)
- {
- int desired_marker_type, desired_marker_size;
- double xd, yd, size_d;
- int i_x, i_y;
- switch (type)
- {
- case M_DOT:
- desired_marker_type = CGM_M_DOT;
- break;
- case M_PLUS:
- desired_marker_type = CGM_M_PLUS;
- break;
- case M_ASTERISK:
- desired_marker_type = CGM_M_ASTERISK;
- break;
- case M_CIRCLE:
- desired_marker_type = CGM_M_CIRCLE;
- break;
- case M_CROSS:
- desired_marker_type = CGM_M_CROSS;
- break;
- default:
- return false;
- break;
- }
- if (_plotter->drawstate->pen_type != 0)
-
- {
- if (_plotter->cgm_marker_type != desired_marker_type)
-
- {
- int byte_count, data_byte_count, data_len;
-
- data_len = 2;
- byte_count = data_byte_count = 0;
- _cgm_emit_command_header (_plotter->data->page, _plotter->cgm_encoding,
- CGM_ATTRIBUTE_ELEMENT, 6,
- data_len, &byte_count,
- "MARKERTYPE");
- _cgm_emit_index (_plotter->data->page, false, _plotter->cgm_encoding,
- desired_marker_type,
- data_len, &data_byte_count, &byte_count);
- _cgm_emit_command_terminator (_plotter->data->page, _plotter->cgm_encoding,
- &byte_count);
-
-
- _plotter->cgm_marker_type = desired_marker_type;
- }
-
-
- size_d = sqrt(XDV(size,0)*XDV(size,0)+YDV(size,0)*YDV(size,0));
- desired_marker_size = IROUND(MAXIMUM_MARKER_DIMENSION * size_d);
-
- if (desired_marker_type != CGM_M_DOT
- && _plotter->cgm_marker_size != desired_marker_size)
-
- {
- int byte_count, data_byte_count, data_len;
-
- data_len = CGM_BINARY_BYTES_PER_INTEGER;
- byte_count = data_byte_count = 0;
- _cgm_emit_command_header (_plotter->data->page, _plotter->cgm_encoding,
- CGM_ATTRIBUTE_ELEMENT, 7,
- data_len, &byte_count,
- "MARKERSIZE");
- _cgm_emit_integer (_plotter->data->page, false, _plotter->cgm_encoding,
- desired_marker_size,
- data_len, &data_byte_count, &byte_count);
- _cgm_emit_command_terminator (_plotter->data->page, _plotter->cgm_encoding,
- &byte_count);
-
-
- _plotter->cgm_marker_size = desired_marker_size;
- }
-
-
- _pl_c_set_pen_color (R___(_plotter) CGM_OBJECT_MARKER);
-
-
- xd = XD(_plotter->drawstate->pos.x, _plotter->drawstate->pos.y);
- yd = YD(_plotter->drawstate->pos.x, _plotter->drawstate->pos.y);
- i_x = IROUND(xd);
- i_y = IROUND(yd);
-
-
- {
- int byte_count, data_byte_count, data_len;
-
- data_len = 1 * 2 * CGM_BINARY_BYTES_PER_INTEGER;
- byte_count = data_byte_count = 0;
- _cgm_emit_command_header (_plotter->data->page, _plotter->cgm_encoding,
- CGM_GRAPHICAL_PRIMITIVE_ELEMENT, 3,
- data_len, &byte_count,
- "MARKER");
- _cgm_emit_point (_plotter->data->page, false, _plotter->cgm_encoding,
- i_x, i_y,
- data_len, &data_byte_count, &byte_count);
- _cgm_emit_command_terminator (_plotter->data->page, _plotter->cgm_encoding,
- &byte_count);
- }
- }
- return true;
- }
|