Exemplo n.º 1
0
static void qcad_clocking_layer_class_init (QCADDesignObjectClass *klass, gpointer data)
  {
#ifdef PROPERTY_UIS
  // Gotta be static so the strings don't die
  static QCADPropertyUIProperty properties[] =
    {
    {NULL,          "title", {0, }},
    {"z-showing",   "units", {0, }},
    {"tile-size",   "units", {0, }},
    {"time-coord",  "units", {0, }},
    } ;

  // clocking_layer.title = "QCA Clocking Layer"
  g_value_set_string (g_value_init (&(properties[0].ui_property_value), G_TYPE_STRING), _("QCA Clocking Layer")) ;
  // clocking_layer.z-showing.units = "nm"
  g_value_set_string (g_value_init (&(properties[1].ui_property_value), G_TYPE_STRING), "nm") ;
  // clocking_layer.tile-size.units = "pixels"
  g_value_set_string (g_value_init (&(properties[2].ui_property_value), G_TYPE_STRING), _("pixels")) ;
  // clocking_layer.time-coord.units = "ns"
  g_value_set_string (g_value_init (&(properties[3].ui_property_value), G_TYPE_STRING), "ns") ;

  qcad_object_class_install_ui_properties (QCAD_OBJECT_CLASS (klass), properties, G_N_ELEMENTS (properties)) ;
  qcad_object_class_install_ui_behaviour (QCAD_OBJECT_CLASS (klass), behaviour, G_N_ELEMENTS (behaviour)) ;
#endif /* def PROPERTY_UIS */

  G_OBJECT_CLASS (klass)->finalize     = qcad_clocking_layer_instance_finalize ;
  G_OBJECT_CLASS (klass)->set_property = set_property ;
  G_OBJECT_CLASS (klass)->get_property = get_property ;

  QCAD_OBJECT_CLASS (klass)->class_get_default_object = class_get_default_object ;

#ifdef GTK_GUI
  QCAD_DESIGN_OBJECT_CLASS (klass)->draw        = draw ;
#endif /* def GTK_GUI */
  QCAD_DESIGN_OBJECT_CLASS (klass)->serialize   = serialize ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->unserialize = unserialize ;

  QCAD_LAYER_CLASS (klass)->do_container_add    = do_container_add ;
  QCAD_LAYER_CLASS (klass)->do_container_remove = do_container_remove ;

  g_object_class_install_property (G_OBJECT_CLASS (klass), QCAD_CLOCKING_LAYER_PROPERTY_SHOW_POTENTIAL,
    g_param_spec_boolean ("show-potential", _("Show Potential"), _("Show potential created by the electrodes on this layer"),
      FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE)) ;

  g_object_class_install_property (G_OBJECT_CLASS (klass), QCAD_CLOCKING_LAYER_PROPERTY_Z_SHOWING,
    g_param_spec_double ("z-showing", _("Distance from layer"), _("Distance from clocking layer to show the cross-section for"),
      -G_MAXDOUBLE, G_MAXDOUBLE, 1, G_PARAM_READABLE | G_PARAM_WRITABLE)) ;

  g_object_class_install_property (G_OBJECT_CLASS (klass), QCAD_CLOCKING_LAYER_PROPERTY_TILE_SIZE,
    g_param_spec_uint ("tile-size", _("Tile Size"), _("Resolution (n x n pixels) used to draw the potential"),
      1, G_MAXUINT, 16, G_PARAM_READABLE | G_PARAM_WRITABLE)) ;

  g_object_class_install_property (G_OBJECT_CLASS (klass), QCAD_CLOCKING_LAYER_PROPERTY_TIME_COORD,
    g_param_spec_double ("time-coord", _("Time Coordinate"), _("Time coordinate to draw the potential for"),
      0, G_MAXDOUBLE, 0, G_PARAM_READABLE | G_PARAM_WRITABLE)) ;
  }
Exemplo n.º 2
0
static void qcad_layer_class_init (QCADDesignObjectClass *klass, gpointer data)
  {
/*#ifdef STDIO_FILEIO*/
  QCAD_DESIGN_OBJECT_CLASS (klass)->unserialize      = unserialize ;
/*  QCAD_DESIGN_OBJECT_CLASS (klass)->serialize        = serialize ;*/
//#endif  def STDIO_FILEIO 
  G_OBJECT_CLASS (klass)->finalize = qcad_layer_instance_finalize ;
/*  QCAD_DESIGN_OBJECT_CLASS (klass)->hit_test         = hit_test ;*/
  QCAD_DESIGN_OBJECT_CLASS (klass)->copy             = copy ;
  }
Exemplo n.º 3
0
static gboolean unserialize (QCADDesignObject *obj, FILE *fp)
  {
  char *pszLine = NULL, *pszValue = NULL ;
  gboolean bStopReading = FALSE, bParentInit = FALSE ;

  if (!SkipPast (fp, '\0', "[TYPE:" QCAD_TYPE_STRING_RULER "]", NULL)) return FALSE ;

  while (TRUE)
    {
    if (NULL == (pszLine = ReadLine (fp, '\0', TRUE)))
      break ;

    if (!strcmp (pszLine, "[#TYPE:" QCAD_TYPE_STRING_RULER "]"))
      {
      g_free (pszLine) ;
      break ;
      }

    if (!bStopReading)
      {
      tokenize_line (pszLine, strlen (pszLine), &pszValue, '=') ;

      if (!strncmp (pszLine, "[TYPE:", 6))
        {
        if (!(bParentInit = QCAD_DESIGN_OBJECT_CLASS (g_type_class_peek (g_type_parent (QCAD_TYPE_STRETCHY_OBJECT)))->unserialize (obj, fp)))
          bStopReading = TRUE ;
        }
      }
    g_free (pszLine) ;
    g_free (ReadLine (fp, '\0', FALSE)) ;
    }

  return bParentInit ;
  }
Exemplo n.º 4
0
static void move (QCADDesignObject *obj, double dxWorld, double dyWorld)
  {
  int Nix ;
  QCADRuler *ruler = QCAD_RULER (obj) ;

  QCAD_DESIGN_OBJECT_CLASS (g_type_class_peek (g_type_parent (QCAD_TYPE_RULER)))->move (obj, dxWorld, dyWorld) ;

  for (Nix = 0 ; Nix < ruler->icLabelsVisible ; Nix++)
    qcad_design_object_move (QCAD_DESIGN_OBJECT (exp_array_index_1d (ruler->labels, GRADUATION, Nix).lbl), dxWorld, dyWorld) ;
  }
Exemplo n.º 5
0
static void draw (QCADDesignObject *obj, GdkDrawable *dst, GdkFunction rop, GdkRectangle *rcClip)
  {
	int Nix, Nix1 ;
  QCADClockingLayer *clocking_layer = QCAD_CLOCKING_LAYER (obj) ;
  QCADLayer *layer = QCAD_LAYER (obj) ;
  GdkGC *gc = NULL ;
  double potential ;
  GList *llItr = NULL ;
  double x, y;

  QCAD_DESIGN_OBJECT_CLASS (g_type_class_peek (g_type_parent (QCAD_TYPE_CLOCKING_LAYER)))->draw (obj, dst, rop, rcClip) ;

  gc = gdk_gc_new (dst) ;
  gdk_gc_set_foreground (gc, clr_idx_to_clr_struct (RED)) ;
  gdk_gc_set_background (gc, clr_idx_to_clr_struct (RED)) ;
  gdk_gc_set_clip_rectangle (gc, rcClip) ;

  if (NULL != layer->lstObjs && clocking_layer->bDrawPotential)
    {
    GdkPixbuf *pb = NULL ;
    pb = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, clocking_layer->tile_size, clocking_layer->tile_size) ;
	
		for (Nix = 0; Nix < Nx; Nix++) {
			x = xmin+dx*Nix;
			for (Nix1 = 0; Nix1 < Ny; Nix1++) {
				y = ymin+dy*Nix1;
				potential = get_potential (x, y, clocking_layer->z_to_draw, Nx, Ny, Nz, dx, dy, dz, xmin, ymin)  ;
								
/*
				 
        if (fabs (potential) < clocking_layer->dExtremePotential / 100.0)
          {
          fprintf (stderr, "Potential too small - breaking out\n") ;
//          continue ;
          }
*/
        gdk_pixbuf_fill (pb,
          ((potential > 0) ? 0xFF000000 : 0x0000FF00) | (((int)((fabs (potential) / clocking_layer->dExtremePotential) * 128.0)) & 0xFF)) ;
//        fprintf (stderr, "opacity = %lf/%lf * 255\n", potential, clocking_layer->dExtremePotential) ;
				
        gdk_draw_pixbuf (dst, gc, pb, 0, 0, Nix * clocking_layer->tile_size,  Nix1 * clocking_layer->tile_size, clocking_layer->tile_size, clocking_layer->tile_size, GDK_RGB_DITHER_NONE, 0, 0) ;
		//gdk_draw_pixbuf (dst, gc, pb, 0, 0, Nix * clocking_layer->tile_size, Nix1 * clocking_layer->tile_size, clocking_layer->tile_size, clocking_layer->tile_size, GDK_RGB_DITHER_NONE, 0, 0) ;
				
//        gdk_draw_rectangle (dst, gc, TRUE, 
//          Nix * clocking_layer->tile_size + (clocking_layer->tile_size >> 1) - 2,
//          Nix1 * clocking_layer->tile_size + (clocking_layer->tile_size >> 1) - 2,
//          5, 5) ;
			}
		}
    g_object_unref (pb) ;
    }

  g_object_unref (gc) ;
	}
Exemplo n.º 6
0
static void serialize (QCADDesignObject *obj, FILE *fp)
  {
  // output object type
  fprintf(fp, "[TYPE:%s]\n", QCAD_TYPE_STRING_RULER);

  // call parent serialize function
  QCAD_DESIGN_OBJECT_CLASS (g_type_class_peek (g_type_parent (QCAD_TYPE_RULER)))->serialize (obj, fp) ;

  // output end of object
  fprintf(fp, "[#TYPE:%s]\n", QCAD_TYPE_STRING_RULER);
  }
Exemplo n.º 7
0
static void serialize (QCADDesignObject *obj, FILE *fp)
  {
  char pszDouble[G_ASCII_DTOSTR_BUF_SIZE] = "" ;
  QCADRectangleElectrode *rc_electrode = QCAD_RECTANGLE_ELECTRODE (obj) ;

  fprintf (fp, "[TYPE:" QCAD_TYPE_STRING_RECTANGLE_ELECTRODE "]\n") ;
  QCAD_DESIGN_OBJECT_CLASS (g_type_class_peek (g_type_parent (QCAD_TYPE_RECTANGLE_ELECTRODE)))->serialize (obj, fp) ;
  fprintf (fp, "angle=%s\n", g_ascii_dtostr (pszDouble, G_ASCII_DTOSTR_BUF_SIZE, rc_electrode->angle)) ;
  fprintf (fp, "n_x_divisions=%d\n", rc_electrode->n_x_divisions) ;
  fprintf (fp, "n_y_divisions=%d\n", rc_electrode->n_y_divisions) ;
  fprintf (fp, "cxWorld=%s\n", g_ascii_dtostr (pszDouble, G_ASCII_DTOSTR_BUF_SIZE, rc_electrode->cxWorld)) ;
  fprintf (fp, "cyWorld=%s\n", g_ascii_dtostr (pszDouble, G_ASCII_DTOSTR_BUF_SIZE, rc_electrode->cyWorld)) ;
  fprintf (fp, "[#TYPE:" QCAD_TYPE_STRING_RECTANGLE_ELECTRODE "]\n") ;
  }
Exemplo n.º 8
0
static gboolean unserialize (QCADDesignObject *obj, FILE *fp)
  {
  QCADClockingLayer *clocking_layer = QCAD_CLOCKING_LAYER (obj) ;
  char *pszLine = NULL, *pszValue = NULL ;
  gboolean bStopReading = FALSE, bParentInit = FALSE ;

  if (!SkipPast (fp, '\0', "[TYPE:" QCAD_TYPE_STRING_CLOCKING_LAYER "]", NULL)) return FALSE ;

  while (TRUE)
    {
    if (NULL == (pszLine = ReadLine (fp, '\0', TRUE))) break ;
    if (!strcmp ("[#TYPE:" QCAD_TYPE_STRING_CLOCKING_LAYER "]", pszLine))
      {
      g_free (pszLine) ;
      break ;
      }

    if (!bStopReading)
      {
      tokenize_line (pszLine, strlen (pszLine), &pszValue, '=') ;

      if (!strncmp (pszLine, "[TYPE:", 6))
        {
        tokenize_line_type (pszLine, strlen (pszLine), &pszValue, ':') ;

        if (!strcmp (pszValue, QCAD_TYPE_STRING_LAYER))
          {
          if (!(bParentInit = QCAD_DESIGN_OBJECT_CLASS (g_type_class_peek (g_type_parent (QCAD_TYPE_CLOCKING_LAYER)))->unserialize (obj, fp)))
            bStopReading = TRUE ;
          }
        }
      else
      if (!strcmp (pszLine, "bDrawPotential"))
        clocking_layer->bDrawPotential = strcmp (pszValue, "TRUE") ? FALSE : TRUE ;
      else
      if (!strcmp (pszLine, "z_to_draw"))
        clocking_layer->z_to_draw = g_ascii_strtod (pszValue, NULL) ;
      else
      if (!strcmp (pszLine, "tile_size"))
        clocking_layer->tile_size = atoi (pszValue) ;
      else
      if (!strcmp (pszLine, "time_coord"))
        clocking_layer->time_coord = g_ascii_strtod (pszValue, NULL) ;
      }
    g_free (pszLine) ;
    g_free (ReadLine (fp, '\0', FALSE)) ;
    }
  return (bParentInit && !bStopReading) ;
  }
Exemplo n.º 9
0
static void serialize (QCADDesignObject *obj, FILE *fp)
  {
  QCADClockingLayer *clocking_layer = NULL ;
  char pszDouble[G_ASCII_DTOSTR_BUF_SIZE] = "" ;

  if (NULL == obj) return ;

  clocking_layer = QCAD_CLOCKING_LAYER (obj) ;

  fprintf (fp, "[TYPE:" QCAD_TYPE_STRING_CLOCKING_LAYER "]\n") ;
  QCAD_DESIGN_OBJECT_CLASS (g_type_class_peek (g_type_parent (QCAD_TYPE_CLOCKING_LAYER)))->serialize (obj, fp) ;
  fprintf (fp, "bDrawPotential=%s\n", clocking_layer->bDrawPotential ? "TRUE" : "FALSE") ;
  fprintf (fp, "z_to_draw=%s\n", g_ascii_dtostr (pszDouble, G_ASCII_DTOSTR_BUF_SIZE, clocking_layer->z_to_draw)) ;
  fprintf (fp, "tile_size=%d\n", clocking_layer->tile_size) ;
  fprintf (fp, "time_coord=%s\n", g_ascii_dtostr (pszDouble, G_ASCII_DTOSTR_BUF_SIZE, clocking_layer->time_coord)) ;
  fprintf (fp, "[#TYPE:" QCAD_TYPE_STRING_CLOCKING_LAYER "]\n") ;
  }
Exemplo n.º 10
0
static void qcad_label_class_init (GObjectClass *klass, gpointer data)
  {
  DBG_OO (fprintf (stderr, "QCADLabel::class_init:Entering\n")) ;
#ifdef GTK_GUI
  if (0 == clrBlue.pixel)
    gdk_colormap_alloc_color (gdk_colormap_get_system (), &clrBlue, FALSE, TRUE) ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->draw = draw ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->properties = properties ;
#endif /* def GTK_GUI */
#ifdef STDIO_FILEIO
  QCAD_DESIGN_OBJECT_CLASS (klass)->serialize = serialize ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->unserialize = unserialize ;
#endif /* def STDIO_FILEIO */
  G_OBJECT_CLASS (klass)->finalize = qcad_label_instance_finalize ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->copy = copy ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->PostScript_preamble = PostScript_preamble ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->PostScript_instance = PostScript_instance ;
  DBG_OO (fprintf (stderr, "QCADLabel::class_init:Leaving\n")) ;
  }
Exemplo n.º 11
0
static void move (QCADDesignObject *obj, double dxDelta, double dyDelta)
  {
  int Nix, Nix1 ;
  QCADRectangleElectrode *rc_electrode = QCAD_RECTANGLE_ELECTRODE (obj) ;

  QCAD_DESIGN_OBJECT_CLASS (g_type_class_peek_parent (QCAD_DESIGN_OBJECT_GET_CLASS (obj)))->move (obj, dxDelta, dyDelta) ;

  rc_electrode->precompute_params.pt[0].xWorld += dxDelta ;
  rc_electrode->precompute_params.pt[0].yWorld += dyDelta ;
  rc_electrode->precompute_params.pt[1].xWorld += dxDelta ;
  rc_electrode->precompute_params.pt[1].yWorld += dyDelta ;
  rc_electrode->precompute_params.pt[2].xWorld += dxDelta ;
  rc_electrode->precompute_params.pt[2].yWorld += dyDelta ;
  rc_electrode->precompute_params.pt[3].xWorld += dxDelta ;
  rc_electrode->precompute_params.pt[3].yWorld += dyDelta ;

  if (NULL != rc_electrode->precompute_params.pts)
    for (Nix = 0 ; Nix < rc_electrode->n_x_divisions ; Nix++)
      for (Nix1 = 0 ; Nix1 < rc_electrode->n_y_divisions ; Nix1++)
        {
        exp_array_index_2d (rc_electrode->precompute_params.pts, WorldPoint, Nix1, Nix).xWorld += dxDelta ;
        exp_array_index_2d (rc_electrode->precompute_params.pts, WorldPoint, Nix1, Nix).yWorld += dyDelta ;
        }
  }
Exemplo n.º 12
0
static void qcad_ruler_class_init (GObjectClass *klass, gpointer data)
  {
  DBG_OO (fprintf (stderr, "QCADRuler::class_init:Entering\n")) ;
#ifdef GTK_GUI
  if (0 == clrCyan.pixel)
    gdk_colormap_alloc_color (gdk_colormap_get_system (), &clrCyan, FALSE, TRUE) ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->draw = draw ;
#endif /* def GTK_GUI */
#ifdef STDIO_FILEIO
  QCAD_DESIGN_OBJECT_CLASS (klass)->serialize = serialize ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->unserialize = unserialize ;
#endif /* def STDIO_FILEIO */
  G_OBJECT_CLASS (klass)->finalize = qcad_ruler_instance_finalize ;
  QCAD_STRETCHY_OBJECT_CLASS (klass)->stretch_draw_state_change = stretch_draw_state_change ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->move = move ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->PostScript_preamble = PostScript_preamble ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->PostScript_instance = PostScript_instance ;
  DBG_OO (fprintf (stderr, "QCADRuler::class_init:Leaving\n")) ;
  }
Exemplo n.º 13
0
static void copy (QCADDesignObject *src, QCADDesignObject *dst)
  {
  QCAD_DESIGN_OBJECT_CLASS (g_type_class_peek (g_type_parent (QCAD_TYPE_LABEL)))->copy (src, dst) ;
  QCAD_LABEL (dst)->psz = g_strdup (QCAD_LABEL (src)->psz) ;
  QCAD_LABEL (dst)->bNeedsEPMDraw = TRUE ;
  }
Exemplo n.º 14
0
static gboolean unserialize (QCADDesignObject *obj, FILE *fp)
  {
  QCADRectangleElectrode *rc_electrode = QCAD_RECTANGLE_ELECTRODE (obj) ;
  char *pszLine = NULL, *pszValue = NULL ;
  gboolean bStopReading = FALSE, bParentInit = FALSE ;

  if (!SkipPast (fp, '\0', "[TYPE:" QCAD_TYPE_STRING_RECTANGLE_ELECTRODE "]", NULL)) return FALSE ;

  while (TRUE)
    {
    if (NULL == (pszLine = ReadLine (fp, '\0', TRUE))) break ;

    if (!strcmp ("[#TYPE:" QCAD_TYPE_STRING_RECTANGLE_ELECTRODE "]", pszLine))
      {
      g_free (pszLine) ;
      break ;
      }

    if (!bStopReading)
      {
      tokenize_line (pszLine, strlen (pszLine), &pszValue, '=') ;

      if (!strncmp (pszLine, "[TYPE:", 6))
        {
        tokenize_line_type (pszLine, strlen (pszLine), &pszValue, ':') ;

        if (!strcmp (pszValue, QCAD_TYPE_STRING_ELECTRODE))
          {
          if (!(bParentInit = QCAD_DESIGN_OBJECT_CLASS (g_type_class_peek (g_type_parent (QCAD_TYPE_RECTANGLE_ELECTRODE)))->unserialize (obj, fp)))
            bStopReading = TRUE ;
          }
        }
      else
      if (!strcmp (pszLine, "angle"))
        rc_electrode->angle = g_ascii_strtod (pszValue, NULL) ;
      else
      if (!strcmp (pszLine, "n_x_divisions"))
        rc_electrode->n_x_divisions = atoi (pszValue) ;
      else
      if (!strcmp (pszLine, "n_y_divisions"))
        rc_electrode->n_y_divisions = atoi (pszValue) ;
      else
      if (!strcmp (pszLine, "cxWorld"))
        rc_electrode->cxWorld = g_ascii_strtod (pszValue, NULL) ;
      else
      if (!strcmp (pszLine, "cyWorld"))
        rc_electrode->cyWorld = g_ascii_strtod (pszValue, NULL) ;
      }
    g_free (pszLine) ;
    g_free (ReadLine (fp, '\0', FALSE)) ;
    }

  if (bParentInit && !bStopReading)
    {
    if (QCAD_DESIGN_OBJECT_CLASS (QCAD_RECTANGLE_ELECTRODE_GET_CLASS (rc_electrode))->unserialize == unserialize)
      QCAD_ELECTRODE_GET_CLASS (rc_electrode)->precompute (QCAD_ELECTRODE (rc_electrode)) ;
    return TRUE ;
    }
  else
    return FALSE ;
  }
Exemplo n.º 15
0
static void qcad_rectangle_electrode_class_init (GObjectClass *klass, gpointer data)
  {
#ifdef PROPERTY_UIS
  // Gotta be static so the strings don't die
  static QCADPropertyUIProperty properties[] =
    {
    {NULL,     "title",     {0, }},
    {"width",  "units",     {0, }},
    {"height", "units",     {0, }},
    {"angle",  "units",     {0, }},
    } ;

  // RectangleElectrode.title = "QCA Rectangular Electrode"
  g_value_set_string (g_value_init (&(properties[0].ui_property_value), G_TYPE_STRING), _("QCA Rectangular Electrode")) ;
  // RectangleElectrode.width.units = "nm"
  g_value_set_string (g_value_init (&(properties[1].ui_property_value), G_TYPE_STRING), "nm") ;
  // RectangleElectrode.height.units = "nm"
  g_value_set_string (g_value_init (&(properties[2].ui_property_value), G_TYPE_STRING), "nm") ;
  // RectangleElectrode.angle.units = "°"
  g_value_set_string (g_value_init (&(properties[3].ui_property_value), G_TYPE_STRING), "°") ;

  qcad_object_class_install_ui_properties (QCAD_OBJECT_CLASS (klass), properties, G_N_ELEMENTS (properties)) ;
#endif /* def PROPERTY_UIS */

  G_OBJECT_CLASS (klass)->finalize     = finalize ;
  G_OBJECT_CLASS (klass)->set_property = set_property ;
  G_OBJECT_CLASS (klass)->get_property = get_property ;
  QCAD_OBJECT_CLASS (klass)->copy                     = copy ;
  QCAD_OBJECT_CLASS (klass)->class_get_default_object = class_get_default_object ;
#ifdef GTK_GUI
  QCAD_DESIGN_OBJECT_CLASS (klass)->draw                       = draw ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->mh.button_pressed          = (GCallback)button_pressed ;
#endif /* def GTK_GUI */
  QCAD_DESIGN_OBJECT_CLASS (klass)->PostScript_preamble        = PostScript_preamble ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->PostScript_instance        = PostScript_instance ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->move                       = move ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->serialize                  = serialize ;
  QCAD_DESIGN_OBJECT_CLASS (klass)->unserialize                = unserialize ;

  //QCAD_ELECTRODE_CLASS (klass)->get_potential     = get_potential ;
  QCAD_ELECTRODE_CLASS (klass)->get_area          = get_area ;
	QCAD_ELECTRODE_CLASS (klass)->get_long_side     = get_long_side ;
	QCAD_ELECTRODE_CLASS (klass)->get_short_side    = get_short_side ;
  QCAD_ELECTRODE_CLASS (klass)->precompute        = precompute ;
  QCAD_ELECTRODE_CLASS (klass)->extreme_potential = extreme_potential ;

  g_object_class_install_property (G_OBJECT_CLASS (klass), QCAD_RECTANGLE_ELECTRODE_PROPERTY_CX,
    g_param_spec_double ("width", _("Electrode Width"), _("Electrode Width"),
      0.1, 1e9,  6.0, G_PARAM_READABLE | G_PARAM_WRITABLE)) ;

  g_object_class_install_property (G_OBJECT_CLASS (klass), QCAD_RECTANGLE_ELECTRODE_PROPERTY_CY,
    g_param_spec_double ("height", _("Electrode Height"), _("Electrode Height"),
      0.1, 1e9, 40.0, G_PARAM_READABLE | G_PARAM_WRITABLE)) ;

  g_object_class_install_property (G_OBJECT_CLASS (klass), QCAD_RECTANGLE_ELECTRODE_PROPERTY_X_DOTS,
    g_param_spec_uint ("x-dots", _("x Divisions"), _("Number of x divisions"),
      1, G_MAXUINT, 2, G_PARAM_READABLE | G_PARAM_WRITABLE)) ;

  g_object_class_install_property (G_OBJECT_CLASS (klass), QCAD_RECTANGLE_ELECTRODE_PROPERTY_Y_DOTS,
    g_param_spec_uint ("y-dots", _("y Divisions"), _("Number of y divisions"),
      1, G_MAXUINT, 10, G_PARAM_READABLE | G_PARAM_WRITABLE)) ;

  g_object_class_install_property (G_OBJECT_CLASS (klass), QCAD_RECTANGLE_ELECTRODE_PROPERTY_ANGLE,
    g_param_spec_double ("angle", _("Electrode Angle"), _("Electrode Angle"),
      0.0, 360, 0.0, G_PARAM_READABLE | G_PARAM_WRITABLE)) ;
  }
Exemplo n.º 16
0
static GHashTable *qcad_layer_create_default_properties (LayerType type)
  {
  GHashTable *props = NULL ;
  GList *llItr = NULL ;

  props = g_hash_table_new (NULL, NULL) ;
  for (llItr = g_hash_table_lookup (qcad_layer_object_containment_rules (), (gpointer)(type)) ; llItr != NULL ; llItr = llItr->next)
    g_hash_table_insert (props, llItr->data, qcad_design_object_class_get_properties (QCAD_DESIGN_OBJECT_CLASS (g_type_class_peek ((GType)(llItr->data))))) ;

  return props ;
  }