当前位置: 首页>>代码示例>>C++>>正文


C++ GetShape函数代码示例

本文整理汇总了C++中GetShape函数的典型用法代码示例。如果您正苦于以下问题:C++ GetShape函数的具体用法?C++ GetShape怎么用?C++ GetShape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetShape函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WXUNUSED

void MyEvtHandler::OnDragRight(bool WXUNUSED(draw), double x, double y, int WXUNUSED(keys), int attachment)
{
  // Force attachment to be zero for now
  attachment = 0;

  wxClientDC dc(GetShape()->GetCanvas());
  GetShape()->GetCanvas()->PrepareDC(dc);

  wxPen dottedPen(*wxBLACK, 1, wxDOT);
  dc.SetLogicalFunction(OGLRBLF);
  dc.SetPen(dottedPen);
  double xp, yp;
  GetShape()->GetAttachmentPosition(attachment, &xp, &yp);
  dc.DrawLine((long) xp, (long) yp, (long) x, (long) y);
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:15,代码来源:doc.cpp

示例2: GetShape

// Returns true if the unichar sets are equal between the shapes.
bool ShapeTable::EqualUnichars(int shape_id1, int shape_id2) const {
  const Shape& shape1 = GetShape(shape_id1);
  const Shape& shape2 = GetShape(shape_id2);
  for (int c1 = 0; c1 < shape1.size(); ++c1) {
    int unichar_id1 = shape1[c1].unichar_id;
    if (!shape2.ContainsUnichar(unichar_id1))
      return false;
  }
  for (int c2 = 0; c2 < shape2.size(); ++c2) {
    int unichar_id2 = shape2[c2].unichar_id;
    if (!shape1.ContainsUnichar(unichar_id2))
      return false;
  }
  return true;
}
开发者ID:Using1174,项目名称:tesseract,代码行数:16,代码来源:shapetable.cpp

示例3: ShapePos

/*
 * Function BuildPadShapePolygon
 * Build the Corner list of the polygonal shape,
 * depending on shape, extra size (clearance ...) pad and orientation
 * Note: for Round and oval pads this function is equivalent to
 * TransformShapeWithClearanceToPolygon, but not for other shapes
 */
void D_PAD::BuildPadShapePolygon( SHAPE_POLY_SET& aCornerBuffer,
                                  wxSize aInflateValue, int aSegmentsPerCircle,
                                  double aCorrectionFactor ) const
{
    wxPoint corners[4];
    wxPoint PadShapePos = ShapePos();         /* Note: for pad having a shape offset,
                                                     * the pad position is NOT the shape position */
    switch( GetShape() )
    {
    case PAD_SHAPE_CIRCLE:
    case PAD_SHAPE_OVAL:
        TransformShapeWithClearanceToPolygon( aCornerBuffer, aInflateValue.x,
                                              aSegmentsPerCircle, aCorrectionFactor );
        break;

    case PAD_SHAPE_TRAPEZOID:
    case PAD_SHAPE_RECT:
        aCornerBuffer.NewOutline();

        BuildPadPolygon( corners, aInflateValue, m_Orient );
        for( int ii = 0; ii < 4; ii++ )
        {
            corners[ii] += PadShapePos;          // Shift origin to position
            aCornerBuffer.Append( corners[ii].x, corners[ii].y );
        }

        break;
    }
}
开发者ID:corecode,项目名称:kicad-source-mirror,代码行数:36,代码来源:board_items_to_polygon_shape_transform.cpp

示例4: FixPosWithShape

void LRSeparateComplex::FixPosWithShape(sm::vec2& pos, const std::string& filepath) const
{
	std::string path = filepath.substr(0, filepath.find_last_of('.')) + "_shape.json";
	std::string shape_path = m_dir + "\\" + m_point_dir + "\\" + path;
	if (!ee::FileHelper::IsFileExist(shape_path)) {
		return;
	}

	auto sym = ee::SymbolMgr::Instance()->FetchSymbol(shape_path);
	auto shape_symbol = std::dynamic_pointer_cast<eshape::Symbol>(sym);
	if (!shape_symbol) {
		throw ee::Exception("shape file err:%s", filepath);
	}
	
	auto shape = shape_symbol->GetShape();
	if (!shape) {
		throw ee::Exception("shape file empty:%s", filepath);
	}

	if (auto point = std::dynamic_pointer_cast<eshape::PointShape>(shape)) {
		pos += point->GetPos();
	} else {
		throw ee::Exception("shape file is not point:%s", filepath);
	}
}
开发者ID:xzrunner,项目名称:easyeditor,代码行数:25,代码来源:LRSeparateComplex.cpp

示例5: GetShape

LAYER_MSK TRACK::GetLayerMask() const
{
    if( Type() == PCB_VIA_T )
    {
        int via_type = GetShape();

        if( via_type == VIA_THROUGH )
            return ALL_CU_LAYERS;

        // VIA_BLIND_BURIED or VIA_MICRVIA:

        LAYER_NUM bottom_layer, top_layer;

        // LayerPair() knows how layers are stored
        ( (SEGVIA*) this )->LayerPair( &top_layer, &bottom_layer );

        LAYER_MSK layermask = NO_LAYERS;

        while( bottom_layer <= top_layer )
        {
            layermask |= ::GetLayerMask( bottom_layer );
            ++bottom_layer;
        }

        return layermask;
    }
    else
    {
        return ::GetLayerMask( m_Layer );
    }
}
开发者ID:Th0rN13,项目名称:kicad-source-mirror,代码行数:31,代码来源:class_track.cpp

示例6: WXUNUSED

void MyEvtHandler::OnEndDragRight(double x, double y, int WXUNUSED(keys), int WXUNUSED(attachment))
{
  GetShape()->GetCanvas()->ReleaseMouse();
  MyCanvas *canvas = (MyCanvas *)GetShape()->GetCanvas();

  // Check if we're on an object
  int new_attachment;
  wxShape *otherShape = canvas->FindFirstSensitiveShape(x, y, &new_attachment, OP_DRAG_RIGHT);

  if (otherShape && !otherShape->IsKindOf(CLASSINFO(wxLineShape)))
  {
    canvas->view->GetDocument()->GetCommandProcessor()->Submit(
      new DiagramCommand(_T("wxLineShape"), OGLEDIT_ADD_LINE, (DiagramDocument *)canvas->view->GetDocument(), CLASSINFO(wxLineShape),
      0.0, 0.0, false, NULL, GetShape(), otherShape));
  }
}
开发者ID:BackupTheBerlios,项目名称:wxbeos-svn,代码行数:16,代码来源:doc.cpp

示例7: switch

int D_PAD::boundingRadius() const
{
    int x, y;
    int radius;

    switch( GetShape() )
    {
    case PAD_SHAPE_CIRCLE:
        radius = m_Size.x / 2;
        break;

    case PAD_SHAPE_OVAL:
        radius = std::max( m_Size.x, m_Size.y ) / 2;
        break;

    case PAD_SHAPE_RECT:
        radius = 1 + KiROUND( EuclideanNorm( m_Size ) / 2 );
        break;

    case PAD_SHAPE_TRAPEZOID:
        x = m_Size.x + std::abs( m_DeltaSize.y );   // Remember: m_DeltaSize.y is the m_Size.x change
        y = m_Size.y + std::abs( m_DeltaSize.x );   // Remember: m_DeltaSize.x is the m_Size.y change
        radius = 1 + KiROUND( hypot( x, y ) / 2 );
        break;

    default:
        radius = 0;
    }

    return radius;
}
开发者ID:corecode,项目名称:kicad-source-mirror,代码行数:31,代码来源:class_pad.cpp

示例8: Spawn

void FollowHub::Update()
{
    _timer++;
    if ( _timer > ( _powerA ? TIMER / 2 : TIMER ) ) {
        _timer = 0;
        _count++;
        if ( IsOnScreen() ) {
            if ( _powerB )
                Spawn( new Chaser( GetPosition() ) );
            else
                Spawn( new Follow( GetPosition() ) );
            PlaySoundRandom( Lib::SOUND_ENEMY_SPAWN );
        }
    }

    if ( GetPosition()._x < 0 )
        _dir.Set( 1, 0 );
    else if ( GetPosition()._x > Lib::WIDTH )
        _dir.Set( -1, 0 );
    else if ( GetPosition()._y < 0 )
        _dir.Set( 0, 1 );
    else if ( GetPosition()._y > Lib::HEIGHT )
        _dir.Set( 0, -1 );
    else if ( _count > 3 ) {
        _dir.Rotate( -M_PI / M_TWO );
        _count = 0;
    }

    fixed s = _powerA ? M_PT_ZERO_ONE * 5 + M_PT_ONE : M_PT_ZERO_ONE * 5;
    Rotate( s );
    GetShape( 0 ).Rotate( -s );

    Move( _dir * SPEED );
}
开发者ID:grandseiken,项目名称:iispace,代码行数:34,代码来源:enemy.cpp

示例9: GetShape

// Merges shapes with a common unichar over the [start, end) interval.
// Assumes single unichar per shape.
void ShapeTable::ForceFontMerges(int start, int end) {
  for (int s1 = start; s1 < end; ++s1) {
    if (MasterDestinationIndex(s1) == s1 && GetShape(s1).size() == 1) {
      int unichar_id = GetShape(s1)[0].unichar_id;
      for (int s2 = s1 + 1; s2 < end; ++s2) {
        if (MasterDestinationIndex(s2) == s2 && GetShape(s2).size() == 1 &&
            unichar_id == GetShape(s2)[0].unichar_id) {
          MergeShapes(s1, s2);
        }
      }
    }
  }
  ShapeTable compacted(*unicharset_);
  compacted.AppendMasterShapes(*this);
  *this = compacted;
}
开发者ID:0xkasun,项目名称:Dummy_Tes,代码行数:18,代码来源:shapetable.cpp

示例10: Collider2D

    RigidBody2D::RigidBody2D(const RigidBody2D& other, Object& newObj)
        : Collider2D(other, newObj)
    {
        b2BodyDef bd;
        b2FixtureDef fdf;

        auto& pos = getObject()->getGlobalPosition();
        bd.angle = glm::eulerAngles(getObject()->getGlobalRotation()).z;
        bd.position = b2Vec2(pos.x, pos.y);
        bd.userData = this;

        auto om = other.m_body;

        bd.type = om->GetType();
        newObj.setIgnoreParent(other.getObject()->ignoresParent());
        fdf.isSensor = om->GetFixtureList()->IsSensor();
        bd.allowSleep = om->IsSleepingAllowed();

        m_body = other.m_worldRef2D.m_worldData2D->CreateBody(&bd);

        auto omf = om->GetFixtureList();

        fdf.filter = omf->GetFilterData();
        fdf.friction = omf->GetFriction();
        fdf.restitution = omf->GetRestitution();

        fdf.shape = omf->GetShape();
        fdf.density = omf->GetDensity();

        m_body->CreateFixture(&fdf);
    }
开发者ID:Jopnal,项目名称:Jopnal,代码行数:31,代码来源:RigidBody2D.cpp

示例11: switch

wxString D_PAD::ShowPadShape() const
{
    switch( GetShape() )
    {
    case PAD_SHAPE_CIRCLE:
        return _( "Circle" );

    case PAD_SHAPE_OVAL:
        return _( "Oval" );

    case PAD_SHAPE_RECT:
        return _( "Rect" );

    case PAD_SHAPE_TRAPEZOID:
        return _( "Trap" );

    case PAD_SHAPE_ROUNDRECT:
        return _( "Roundrect" );

    case PAD_SHAPE_CUSTOM:
        return _( "CustomShape" );

    default:
        return wxT( "???" );
    }
}
开发者ID:cpavlina,项目名称:kicad,代码行数:26,代码来源:class_pad.cpp

示例12: switch

int D_PAD::boundingRadius() const
{
    int x, y;
    int radius;

    switch( GetShape() )
    {
    case PAD_CIRCLE:
        radius = m_Size.x / 2;
        break;

    case PAD_OVAL:
        radius = std::max( m_Size.x, m_Size.y ) / 2;
        break;

    case PAD_RECT:
        radius = 1 + (int) ( sqrt( (double) m_Size.y * m_Size.y
                                 + (double) m_Size.x * m_Size.x ) / 2 );
        break;

    case PAD_TRAPEZOID:
        x = m_Size.x + std::abs( m_DeltaSize.y );   // Remember: m_DeltaSize.y is the m_Size.x change
        y = m_Size.y + std::abs( m_DeltaSize.x );   // Remember: m_DeltaSize.x is the m_Size.y change
        radius = 1 + (int) ( sqrt( (double) y * y + (double) x * x ) / 2 );
        break;

    default:
        radius = 0;
    }

    return radius;
}
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:32,代码来源:class_pad.cpp

示例13: STRING

// Returns a string listing the classes/fonts in a shape.
STRING ShapeTable::DebugStr(int shape_id) const {
  if (shape_id < 0 || shape_id >= shape_table_.size())
    return STRING("INVALID_UNICHAR_ID");
  const Shape& shape = GetShape(shape_id);
  STRING result;
  result.add_str_int("Shape", shape_id);
  if (shape.size() > 100) {
    result.add_str_int(" Num unichars=", shape.size());
    return result;
  }
  for (int c = 0; c < shape.size(); ++c) {
    result.add_str_int(" c_id=", shape[c].unichar_id);
    result += "=";
    result += unicharset_->id_to_unichar(shape[c].unichar_id);
    if (shape.size() < 10) {
      result.add_str_int(", ", shape[c].font_ids.size());
      result += " fonts =";
      int num_fonts = shape[c].font_ids.size();
      if (num_fonts > 10) {
        result.add_str_int(" ", shape[c].font_ids[0]);
        result.add_str_int(" ... ", shape[c].font_ids[num_fonts - 1]);
      } else {
        for (int f = 0; f < num_fonts; ++f) {
          result.add_str_int(" ", shape[c].font_ids[f]);
        }
      }
    }
  }
  return result;
}
开发者ID:0xkasun,项目名称:Dummy_Tes,代码行数:31,代码来源:shapetable.cpp

示例14: NumShapes

// Returns true if any shape contains multiple unichars.
bool ShapeTable::AnyMultipleUnichars() const {
  int num_shapes = NumShapes();
  for (int s1 = 0; s1 < num_shapes; ++s1) {
    if (MasterDestinationIndex(s1) != s1) continue;
    if (GetShape(s1).size() > 1)
      return true;
  }
  return false;
}
开发者ID:0xkasun,项目名称:Dummy_Tes,代码行数:10,代码来源:shapetable.cpp

示例15: GetShape

void Cursor::Show (void) {
  if (x-1>=0 || y-1>=0 || x-1+sizex<320 || y-1+sizey<200)
    GetShape (x-1,y-1,sizex,sizey,buffer);
  PutPixel (x,y+1,15);
  PutPixel (x,y-1,15);
  PutPixel (x+1,y,15);
  PutPixel (x-1,y,15);
  visible=1;
}
开发者ID:TimofonicJunkRoom,项目名称:Oldies,代码行数:9,代码来源:cursor.cpp


注:本文中的GetShape函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。