OSDN Git Service

Merge branch 'feature/#36529_SlimDXからSharpDXへの移行' into develop
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / design / MatrixConverter.cpp
diff --git a/SlimDXc_Jun2010(VC++2008)/source/design/MatrixConverter.cpp b/SlimDXc_Jun2010(VC++2008)/source/design/MatrixConverter.cpp
deleted file mode 100644 (file)
index 385881e..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-#include "stdafx.h"\r
-/*\r
-* Copyright (c) 2007-2010 SlimDX Group\r
-* \r
-* Permission is hereby granted, free of charge, to any person obtaining a copy\r
-* of this software and associated documentation files (the "Software"), to deal\r
-* in the Software without restriction, including without limitation the rights\r
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
-* copies of the Software, and to permit persons to whom the Software is\r
-* furnished to do so, subject to the following conditions:\r
-* \r
-* The above copyright notice and this permission notice shall be included in\r
-* all copies or substantial portions of the Software.\r
-* \r
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
-* THE SOFTWARE.\r
-*/\r
-\r
-#include "../InternalHelpers.h"\r
-#include "../math/Matrix.h"\r
-\r
-#include "MatrixConverter.h"\r
-#include "FieldPropertyDescriptor.h"\r
-\r
-using namespace System;\r
-using namespace System::Collections;\r
-using namespace System::Drawing;\r
-using namespace System::ComponentModel;\r
-using namespace System::ComponentModel::Design::Serialization;\r
-using namespace System::Globalization;\r
-using namespace System::Reflection;\r
-\r
-namespace SlimDX\r
-{\r
-namespace Design\r
-{\r
-       MatrixConverter::MatrixConverter()\r
-       {\r
-               Type^ type = Matrix::typeid;\r
-               array<PropertyDescriptor^>^ propArray =\r
-               {\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M11")),\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M12")),\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M13")),\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M14")),\r
-\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M21")),\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M22")),\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M23")),\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M24")),\r
-\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M31")),\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M32")),\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M33")),\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M34")),\r
-\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M41")),\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M42")),\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M43")),\r
-                       gcnew FieldPropertyDescriptor(type->GetField("M44")),\r
-               };\r
-\r
-               m_Properties = gcnew PropertyDescriptorCollection(propArray);\r
-       }\r
-\r
-       bool MatrixConverter::CanConvertTo(ITypeDescriptorContext^ context, Type^ destinationType)\r
-       {\r
-               if( destinationType == String::typeid )\r
-                       return true;\r
-               else\r
-                       return ExpandableObjectConverter::CanConvertTo(context, destinationType);\r
-       }\r
-\r
-       bool MatrixConverter::CanConvertFrom(ITypeDescriptorContext^ context, Type^ sourceType)\r
-       {\r
-               if( sourceType == String::typeid )\r
-                       return true;\r
-               else\r
-                       return ExpandableObjectConverter::CanConvertFrom(context, sourceType);\r
-       }\r
-\r
-       Object^ MatrixConverter::ConvertTo(ITypeDescriptorContext^ context, CultureInfo^ culture, Object^ value, Type^ destinationType)\r
-       {\r
-               if( destinationType == nullptr )\r
-                       throw gcnew ArgumentNullException( "destinationType" );\r
-\r
-               if( culture == nullptr )\r
-                       culture = CultureInfo::CurrentCulture;\r
-\r
-               Matrix^ matrix = dynamic_cast<Matrix^>( value );\r
-\r
-               if( destinationType == String::typeid && matrix != nullptr )\r
-               {\r
-                       String^ separator = culture->TextInfo->ListSeparator + " ";\r
-                       TypeConverter^ converter = TypeDescriptor::GetConverter(float::typeid);\r
-                       array<String^>^ stringArray = gcnew array<String^>( 16 );\r
-\r
-                       for( int i = 0; i < 4; i++ )\r
-                       {\r
-                               for( int j = 0; j < 4; j++ )\r
-                                       stringArray[i * 4 + j] = converter->ConvertToString( context, culture, matrix[i, j] );\r
-                       }\r
-\r
-                       return String::Join( separator, stringArray );\r
-               }\r
-\r
-               return ExpandableObjectConverter::ConvertTo(context, culture, value, destinationType);\r
-       }\r
-\r
-       Object^ MatrixConverter::ConvertFrom(ITypeDescriptorContext^ context, CultureInfo^ culture, Object^ value)\r
-       {\r
-               if( culture == nullptr )\r
-                       culture = CultureInfo::CurrentCulture;\r
-\r
-               String^ string = dynamic_cast<String^>( value );\r
-\r
-               if( string != nullptr )\r
-               {\r
-                       string = string->Trim();\r
-                       TypeConverter^ converter = TypeDescriptor::GetConverter(float::typeid);\r
-                       array<String^>^ stringArray = string->Split( culture->TextInfo->ListSeparator[0] );\r
-\r
-                       if( stringArray->Length != 16 )\r
-                               throw gcnew ArgumentException("Invalid matrix format.");\r
-\r
-                       Matrix matrix;\r
-\r
-                       for( int i = 0; i < 4; i++ )\r
-                       {\r
-                               for( int j = 0; j < 4; j++ )\r
-                                       matrix[i, j] = safe_cast<float>( converter->ConvertFromString( context, culture, stringArray[i * 4 + j] ) );\r
-                       }\r
-\r
-                       return matrix;\r
-               }\r
-\r
-               return ExpandableObjectConverter::ConvertFrom(context, culture, value);\r
-       }\r
-\r
-       bool MatrixConverter::GetCreateInstanceSupported(ITypeDescriptorContext^ context)\r
-       {\r
-               SLIMDX_UNREFERENCED_PARAMETER(context);\r
-\r
-               return true;\r
-       }\r
-\r
-       Object^ MatrixConverter::CreateInstance(ITypeDescriptorContext^ context, IDictionary^ propertyValues)\r
-       {\r
-               SLIMDX_UNREFERENCED_PARAMETER(context);\r
-\r
-               if( propertyValues == nullptr )\r
-                       throw gcnew ArgumentNullException( "propertyValues" );\r
-\r
-               Matrix matrix;\r
-\r
-               matrix.M11 = safe_cast<float>( propertyValues["M11"] );\r
-               matrix.M12 = safe_cast<float>( propertyValues["M12"] );\r
-               matrix.M13 = safe_cast<float>( propertyValues["M13"] );\r
-               matrix.M14 = safe_cast<float>( propertyValues["M14"] );\r
-\r
-               matrix.M21 = safe_cast<float>( propertyValues["M21"] );\r
-               matrix.M22 = safe_cast<float>( propertyValues["M22"] );\r
-               matrix.M23 = safe_cast<float>( propertyValues["M23"] );\r
-               matrix.M24 = safe_cast<float>( propertyValues["M24"] );\r
-\r
-               matrix.M31 = safe_cast<float>( propertyValues["M31"] );\r
-               matrix.M32 = safe_cast<float>( propertyValues["M32"] );\r
-               matrix.M33 = safe_cast<float>( propertyValues["M33"] );\r
-               matrix.M34 = safe_cast<float>( propertyValues["M34"] );\r
-\r
-               matrix.M41 = safe_cast<float>( propertyValues["M41"] );\r
-               matrix.M42 = safe_cast<float>( propertyValues["M42"] );\r
-               matrix.M43 = safe_cast<float>( propertyValues["M43"] );\r
-               matrix.M44 = safe_cast<float>( propertyValues["M44"] );\r
-\r
-               return matrix;\r
-       }\r
-\r
-       bool MatrixConverter::GetPropertiesSupported(ITypeDescriptorContext^)\r
-       {\r
-               return true;\r
-       }\r
-\r
-       PropertyDescriptorCollection^ MatrixConverter::GetProperties(ITypeDescriptorContext^, Object^, array<Attribute^>^)\r
-       {\r
-               return m_Properties;\r
-       }\r
-}\r
-}
\ No newline at end of file