protected TokenType() { DistanceOriginCenterPX = SetOriginToCenterDistance(); DistanceOriginAxisMarkersPX = SetOriginToAxisDistance(); DataMarkerOriginPositionPX = SetDataMarkerOriginPosition(); DataMarkerOriginPositionCM = SetDataMarkerOriginPositionCM(); TokenDiagonalPX = SetTokenDiagonal(); TokenClassLUT = InitiliazeTokenClassLUT(); DataGridMarkersStepPX = TokensEngine.CmToPixels(TokenAttributes.TOKEN_DATA_MARKERS_STEP); }
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); }
internal override float SetTokenDiagonal() { return(TokensEngine.CmToPixels(TokenAttributes.TOKEN_4X4_DIAGONAL)); }
internal override float SetDataMarkerOriginPosition() { return(TokensEngine.CmToPixels(TokenAttributes.TOKEN_4X4_DATA_MARKER_ORIGIN)); }
internal override float SetOriginToCenterDistance() { return(TokensEngine.CmToPixels(TokenAttributes.TOKEN_4X4_ORIGIN_TO_CENTER_DST)); }
internal override float SetOriginToAxisDistance() { return(TokensEngine.CmToPixels(TokenAttributes.TOKEN_4X4_ORIGIN_TO_AXIS_MARKERS_DST)); }