Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
c552f74b
Commit
c552f74b
authored
Jan 04, 2010
by
ddpruitt
Browse files
Performance tweak
parent
26f61673
Changes
1
Show whitespace changes
Inline
Side-by-side
SvgElementFactory.cs
View file @
c552f74b
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Collections.Specialized
;
using
System.Collections
;
using
System.Text
;
using
System.Globalization
;
using
System.Globalization
;
using
System.Text.RegularExpressions
;
using
System.Xml
;
using
System.Xml
;
using
System.ComponentModel
;
using
System.ComponentModel
;
using
System.Reflection
;
using
System.Drawing
;
using
System.Drawing.Drawing2D
;
using
System.Diagnostics
;
using
System.Diagnostics
;
using
System.Threading
;
using
System.Linq
;
using
System.Linq
;
using
Svg.Transforms
;
namespace
Svg
namespace
Svg
{
{
/// <summary>
/// <summary>
...
@@ -154,9 +144,32 @@ namespace Svg
...
@@ -154,9 +144,32 @@ namespace Svg
//Trace.TraceInformation("End SetAttributes");
//Trace.TraceInformation("End SetAttributes");
}
}
private
static
Dictionary
<
Type
,
Dictionary
<
string
,
PropertyDescriptorCollection
>>
_propertyDescriptors
=
new
Dictionary
<
Type
,
Dictionary
<
string
,
PropertyDescriptorCollection
>>();
private
static
void
SetPropertyValue
(
SvgElement
element
,
string
attributeName
,
string
attributeValue
,
SvgDocument
document
)
private
static
void
SetPropertyValue
(
SvgElement
element
,
string
attributeName
,
string
attributeValue
,
SvgDocument
document
)
{
{
var
properties
=
TypeDescriptor
.
GetProperties
(
element
.
GetType
(),
new
SvgAttributeAttribute
[]
{
new
SvgAttributeAttribute
(
attributeName
)
});
var
elementType
=
element
.
GetType
();
PropertyDescriptorCollection
properties
;
if
(
_propertyDescriptors
.
Keys
.
Contains
(
elementType
))
{
if
(
_propertyDescriptors
[
elementType
].
Keys
.
Contains
(
attributeName
))
{
properties
=
_propertyDescriptors
[
elementType
][
attributeName
];
}
else
{
properties
=
TypeDescriptor
.
GetProperties
(
elementType
,
new
[]
{
new
SvgAttributeAttribute
(
attributeName
)
});
_propertyDescriptors
[
elementType
].
Add
(
attributeName
,
properties
);
}
}
else
{
properties
=
TypeDescriptor
.
GetProperties
(
element
.
GetType
(),
new
[]
{
new
SvgAttributeAttribute
(
attributeName
)
});
_propertyDescriptors
.
Add
(
elementType
,
new
Dictionary
<
string
,
PropertyDescriptorCollection
>());
_propertyDescriptors
[
elementType
].
Add
(
attributeName
,
properties
);
}
if
(
properties
.
Count
>
0
)
if
(
properties
.
Count
>
0
)
{
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment