X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.Content.MediaContent%2FTizen.Content.MediaContent%2FFaceInfoCommand.cs;h=05b8e84476aa0ad8acd716b8c70e28901f9e1307;hb=5fa5718a930d8d558a0cc0e0c9637e645926ca73;hp=45b4ae2279affdba8eb56c01b1151a05a0ebbe7c;hpb=4a9ca0f19f9ef6ef76e7169ca74326962b19d053;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/FaceInfoCommand.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/FaceInfoCommand.cs index 45b4ae2..05b8e84 100644 --- a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/FaceInfoCommand.cs +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/FaceInfoCommand.cs @@ -19,33 +19,36 @@ using System; namespace Tizen.Content.MediaContent { /// - /// Provides commands to manage face infos in the database. + /// Provides commands to manage face information in the database. /// /// + /// 4 public class FaceInfoCommand : MediaCommand { /// /// Initializes a new instance of the class with the specified . /// - /// A that the commands run on. + /// The that the commands run on. /// is null. - /// has already been disposed of. + /// has already been disposed. + /// 4 public FaceInfoCommand(MediaDatabase database) : base(database) { } /// - /// Deletes a face info from the database. + /// Deletes the face information from the database. /// /// http://tizen.org/privilege/content.write - /// The face info id to delete. + /// The face information ID to delete. /// true if the matched record was found and deleted, otherwise false. /// The is disconnected. - /// The has already been disposed of. + /// The has already been disposed. /// An error occurred while executing the command. /// is null. /// is a zero-length string, contains only white space. /// The caller has no required privilege. + /// 4 public bool Delete(string faceInfoId) { ValidateDatabase(); @@ -64,25 +67,27 @@ namespace Tizen.Content.MediaContent } /// - /// Retrieves the face info. + /// Retrieves the face information. /// /// The containing the results. /// The is disconnected. - /// The has already been disposed of. + /// The has already been disposed. /// An error occurred while executing the command. + /// 4 public MediaDataReader Select() { return Select(null); } /// - /// Retrieves the face info with . + /// Retrieves the face information with the . /// /// The criteria to use to filter. This value can be null. /// The containing the results. /// The is disconnected. - /// The has already been disposed of. + /// The has already been disposed. /// An error occurred while executing the command. + /// 4 public MediaDataReader Select(SelectArguments filter) { ValidateDatabase(); @@ -94,16 +99,16 @@ namespace Tizen.Content.MediaContent /// Updates a tag with the specified tag. /// /// http://tizen.org/privilege/content.write - /// The face info id to update. + /// The face information ID to update. /// The tag value for update. /// true if the matched record was found and updated, otherwise false. - /// Only values set in are updated. /// The is disconnected. - /// The has already been disposed of. + /// The has already been disposed. /// An error occurred while executing the command. /// is null. /// is a zero-length string, contains only white space. /// The caller has no required privilege. + /// 4 public bool UpdateTag(string faceInfoId, string tag) { ValidateDatabase(); @@ -135,5 +140,80 @@ namespace Tizen.Content.MediaContent Interop.Face.Destroy(handle); } } + + /// + /// Inserts new face information to the database with the specified media ID, area, orientation. + /// + /// http://tizen.org/privilege/content.write + /// The media ID to be associated with the face. + /// The region of face in the media. + /// The orientation of the specified media. + /// The containing the results. + /// The is disconnected. + /// The has already been disposed. + /// An error occurred while executing the command. + /// is null. + /// + /// is a zero-length string, contains only white space.
+ /// -or-
+ /// is not valid enumeration. + ///
+ /// The caller has no required privilege. + /// 6 + public FaceInfo Insert(string mediaId, Rectangle area, Orientation orientation) + { + return Insert(mediaId, area, orientation, null); + } + + /// + /// Inserts new face information to the database with the specified media ID, area, orientation, and tag. + /// + /// http://tizen.org/privilege/content.write + /// The media ID to be associated with the face. + /// The region of face in the media. + /// The orientation of specified media. + /// The tag value. + /// The containing the results. + /// The is disconnected. + /// The has already been disposed. + /// An error occurred while executing the command. + /// is null. + /// + /// is a zero-length string, contains only white space.
+ /// -or-
+ /// is not valid enumeration. + ///
+ /// The caller has no required privilege. + /// 6 + public FaceInfo Insert(string mediaId, Rectangle area, Orientation orientation, string tag) + { + ValidateDatabase(); + + ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId)); + ValidationUtil.ValidateEnum(typeof(Orientation), orientation, nameof(orientation)); + + Interop.Face.Create(mediaId, out IntPtr handle).ThrowIfError("Failed to create face handle"); + + try + { + Interop.Face.SetFaceRect(handle, area.X, area.Y, area.Width, area.Height). + ThrowIfError("Failed to set face area"); + + Interop.Face.SetOrientation(handle, orientation).ThrowIfError("Failed to set face orientation"); + + if (tag != null) + { + Interop.Face.SetTag(handle, tag).ThrowIfError("Failed to set face tag"); + } + + Interop.Face.Insert(handle).ThrowIfError("Failed to insert face information"); + + return new FaceInfo(handle); + } + finally + { + Interop.Face.Destroy(handle).ThrowIfError("Failed to destroy face handle"); + } + } } }