//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.StairsAutomation.CS
{
///
/// An abstract base class for stairs components which can be moved via a translation and rotation.
///
public class TransformedStairsComponent
{
private Transform m_transform;
///
/// Constructs a transformed component with the identity transform.
///
public TransformedStairsComponent()
{
m_transform = Autodesk.Revit.DB.Transform.Identity;
}
///
/// Constructs a transformed component with the specified transform.
///
public TransformedStairsComponent(Transform transform)
{
m_transform = transform;
}
///
/// Transforms the given XYZ point by the stored transform.
///
/// The point.
/// The transformed point.
public XYZ TransformPoint(XYZ point)
{
XYZ xyz = m_transform.OfPoint(point);
return xyz;
}
///
/// Transforms the given curve by the stored transform.
///
/// The curve.
/// The transformed curve.
public Curve Transform(Curve curve)
{
return GeometryUtils.TransformCurve(curve, m_transform);
}
///
/// Transforms the given line by the stored transform.
///
/// The line.
/// The transformed line.
public Line Transform(Line line)
{
return Transform(line as Curve) as Line;
}
///
/// Transforms all members of the given curve array by the stored transform.
///
/// The input curves.
/// The transformed curves.
public IList Transform(IList inputs)
{
return GeometryUtils.TransformCurves(inputs, m_transform);
}
}
}