/*----------------------------------------------------------------------------
						Public Code
-----------------------------------------------------------------------------*/
void DisplayProtoList(const char* ch, LIST protolist) {
  void* window = c_create_window("Char samples", 50, 200,
                                 520, 520, -130.0, 130.0, -130.0, 130.0);
  LIST proto = protolist;
  iterate(proto) {
    PROTOTYPE* prototype = reinterpret_cast<PROTOTYPE *>(first_node(proto));
    if (prototype->Significant)
      c_line_color_index(window, Green);
    else if (prototype->NumSamples == 0)
      c_line_color_index(window, Blue);
    else if (prototype->Merged)
      c_line_color_index(window, Magenta);
    else
      c_line_color_index(window, Red);
    float x = CenterX(prototype->Mean);
    float y = CenterY(prototype->Mean);
    double angle = OrientationOf(prototype->Mean) * 2 * M_PI;
    float dx = static_cast<float>(LengthOf(prototype->Mean) * cos(angle) / 2);
    float dy = static_cast<float>(LengthOf(prototype->Mean) * sin(angle) / 2);
    c_move(window, (x - dx) * 256, (y - dy) * 256);
    c_draw(window, (x + dx) * 256, (y + dy) * 256);
    if (prototype->Significant)
      tprintf("Green proto at (%g,%g)+(%g,%g) %d samples\n",
              x, y, dx, dy, prototype->NumSamples);
    else if (prototype->NumSamples > 0 && !prototype->Merged)
      tprintf("Red proto at (%g,%g)+(%g,%g) %d samples\n",
              x, y, dx, dy, prototype->NumSamples);
  }
  c_make_current(window);
}
Ejemplo n.º 2
0
 String(const char* cstr)
 {
     int len = LengthOf(cstr);
     data_ = new char[len + 1];
     
     CopyStr(data_, cstr, len + 1);
 }
Ejemplo n.º 3
0
/**
 * This fills in the fields of the New proto based on the
 * fields of the Old proto.
 *
 * @param New new proto to be filled in
 * @param Old old proto to be converted
 * 
 *  Globals: none
 * 
 * Exceptions: none
 * History: Mon Nov 26 09:45:39 1990, DSJ, Created.
 */
void MakeNewFromOld(PROTO New, PROTOTYPE *Old) {
  New->X = CenterX(Old->Mean);
  New->Y = CenterY(Old->Mean);
  New->Length = LengthOf(Old->Mean);
  New->Angle = OrientationOf(Old->Mean);
  FillABC(New);
} /* MakeNewFromOld */
Ejemplo n.º 4
0
    ///////////////////////////////////////////////////////////////////////
    // Function: Write
    //
    //   Author: $author$
    //     Date: 5/17/2009
    ///////////////////////////////////////////////////////////////////////
    virtual TLength Write
    (const TChar* chars, TLength length=-1) 
    {
        if (INVALID_FILE == (*this).m_attached)
            return -EV_ERROR_NOT_ATTACHED;

        if (0 > length)
        if (0 > (length = LengthOf(chars)))
            return length;

        length = (TLength)(fwrite
        (chars, 1, (size_t)(length), (*this).m_attached));
        return length;
    }
Ejemplo n.º 5
0
/*---------------------------------------------------------------------------*/
void MakeNewFromOld(PROTO New, PROTOTYPE *Old) {
/*
**  Parameters:
**    New new proto to be filled in
**    Old old proto to be converted
**  Globals: none
**  Operation: This fills in the fields of the New proto based on the
**    fields of the Old proto.
**  Return: none
**  Exceptions: none
**  History: Mon Nov 26 09:45:39 1990, DSJ, Created.
*/
  New->X = CenterX(Old->Mean);
  New->Y = CenterY(Old->Mean);
  New->Length = LengthOf(Old->Mean);
  New->Angle = OrientationOf(Old->Mean);
  FillABC(New);
} /* MakeNewFromOld */
Ejemplo n.º 6
0
 int Length() const
 {
     return LengthOf(data_);
 }