コード例 #1
0
ファイル: TokenType.cs プロジェクト: CGVGroup/ToMMI
        protected TokenType()
        {
            DistanceOriginCenterPX      = SetOriginToCenterDistance();
            DistanceOriginAxisMarkersPX = SetOriginToAxisDistance();
            DataMarkerOriginPositionPX  = SetDataMarkerOriginPosition();
            DataMarkerOriginPositionCM  = SetDataMarkerOriginPositionCM();
            TokenDiagonalPX             = SetTokenDiagonal();

            TokenClassLUT = InitiliazeTokenClassLUT();

            DataGridMarkersStepPX = TokensEngine.CmToPixels(TokenAttributes.TOKEN_DATA_MARKERS_STEP);
        }
コード例 #2
0
ファイル: InternalToken.cs プロジェクト: CGVGroup/ToMMI
        private int[] CalculateDataGridIndexes(Vector2 dataCoordinates, ClassComputeDimension dimension)
        {
            int[] result = new int[2];
            float xCoord;
            float yCoord;

            if (dimension == ClassComputeDimension.Pixels)
            {
                xCoord = (dataCoordinates.x - TokenManager.CurrentTokenType.DataMarkerOriginPositionPX) / TokenManager.CurrentTokenType.DataGridMarkersStepPX;
                yCoord = (dataCoordinates.y - TokenManager.CurrentTokenType.DataMarkerOriginPositionPX) / TokenManager.CurrentTokenType.DataGridMarkersStepPX;
            }
            else
            {
                Vector2 dataCoordinatesCM = new Vector2(TokensEngine.PixelsToCm(dataCoordinates.x), TokensEngine.PixelsToCm(dataCoordinates.y));
                xCoord = (dataCoordinatesCM.x - TokenManager.CurrentTokenType.DataMarkerOriginPositionCM) / TokenAttributes.TOKEN_DATA_MARKERS_STEP;
                yCoord = (dataCoordinatesCM.y - TokenManager.CurrentTokenType.DataMarkerOriginPositionCM) / TokenAttributes.TOKEN_DATA_MARKERS_STEP;
            }

            result[0] = (int)Math.Round(xCoord, 0, MidpointRounding.AwayFromZero);
            result[1] = (int)Math.Round(yCoord, 0, MidpointRounding.AwayFromZero);

            return(result);
        }
コード例 #3
0
 internal override float SetTokenDiagonal()
 {
     return(TokensEngine.CmToPixels(TokenAttributes.TOKEN_4X4_DIAGONAL));
 }
コード例 #4
0
 internal override float SetDataMarkerOriginPosition()
 {
     return(TokensEngine.CmToPixels(TokenAttributes.TOKEN_4X4_DATA_MARKER_ORIGIN));
 }
コード例 #5
0
 internal override float SetOriginToCenterDistance()
 {
     return(TokensEngine.CmToPixels(TokenAttributes.TOKEN_4X4_ORIGIN_TO_CENTER_DST));
 }
コード例 #6
0
 internal override float SetOriginToAxisDistance()
 {
     return(TokensEngine.CmToPixels(TokenAttributes.TOKEN_4X4_ORIGIN_TO_AXIS_MARKERS_DST));
 }